SkipVought and PHV,
You're both right (again, pattern developing here!). I was trying to make it too complicated, after your comments I went back and had a fresh look at it and realised it could be solved with what PHV gave me previously.
Thanks!
Hmm on second thoughts I don't think I've worded the question properly...I'll come back in a few minutes and add more detail. I see what you're getting at though SkipVought from what I've written it does look like the same issue.
I have a table of shifts which are entered into a rota application. Let's call them rotaItems. a section of the rotaItems table looks like something like this:
itemId personId weekId dayId hours
=============================================
1 1234 10 2 3
1 1234 10 2 6
1 1234 10 2 7
2 2222...
I thought I had, but apparently not as your example works perfectly, thanks very much! I've sort of been thrown in at the deep end with SQL, there's a lot more to learn than I thought...
Thanks PHV, that second example is actually exactly what I am trying to achieve. Question on your second example though, will that actually return a count of each distinct staffId, or just all records?
This is the problem I'm having. Without the Distinct keyword the COUNT function returns all...
Hi there,
I have a table of data similar to this:
staffId weekNumber hoursWorked
======================================
1 24 41
1 25 12
2 24 36
3 24 29
2 24 39
4 25 18
Each row represents a shift. What I need is to find out how many weeks a staff...
Hi there,
I have a table of data similar to this:
staffId weekNumber hoursWorked
======================================
1 24 41
1 25 12
2 24 36
3 24 29
2 24 39
4 25 18
Each row represents a shift. What I need is to find out how many weeks a staff...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.