If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Summarise groups of data
I've got some data which looks a bit like this:
row_id user sick day sick period 1 A 02/01/2004 1 2 A 03/01/2004 1 3 A 30/01/2004 2 4 B 02/01/2004 1 5 B 01/02/2004 1 6 B 01/03/2004 1 I need a query, or set of queries to populate the sick period column, which has been filled out manually here, so I can summarise by user and number of sick periods. You can see how the rules work; periods of sickness are grouped together. Anyone got any ideas ? Thanks Damien |
#2
|
|||
|
|||
Summarise groups of data
Maybe that is clear to you, but I can't understand the rules that make Sick
Period 1 or 2 or any other number I would think that you might be able to use a totals query and not need to fill in Sick Period. SELECT User, Count(SickDay) as DateCount FROM YourTable GROUP BY User In the query grid, add in the User and Sick Day field Select View: Total from the menu In the Total row, change Group By to Count under the Sick Day Field. damien wrote: I've got some data which looks a bit like this: row_id user sick day sick period 1 A 02/01/2004 1 2 A 03/01/2004 1 3 A 30/01/2004 2 4 B 02/01/2004 1 5 B 01/02/2004 1 6 B 01/03/2004 1 I need a query, or set of queries to populate the sick period column, which has been filled out manually here, so I can summarise by user and number of sick periods. You can see how the rules work; periods of sickness are grouped together. Anyone got any ideas ? Thanks Damien |
#3
|
|||
|
|||
Summarise groups of data
If the sick days are contigious, they are counted as one
sick period; ie if you have 2 days off sick in January, next to each other, they are counted as one period. If you then have two days off sick in February, but they are not next to each other, eg 01/02/2004 and 28/02/2004, you have had 4 days off sick, constituting 3 sick periods. -----Original Message----- Maybe that is clear to you, but I can't understand the rules that make Sick Period 1 or 2 or any other number I would think that you might be able to use a totals query and not need to fill in Sick Period. SELECT User, Count(SickDay) as DateCount FROM YourTable GROUP BY User In the query grid, add in the User and Sick Day field Select View: Total from the menu In the Total row, change Group By to Count under the Sick Day Field. damien wrote: I've got some data which looks a bit like this: row_id user sick day sick period 1 A 02/01/2004 1 2 A 03/01/2004 1 3 A 30/01/2004 2 4 B 02/01/2004 1 5 B 01/02/2004 1 6 B 01/03/2004 1 I need a query, or set of queries to populate the sick period column, which has been filled out manually here, so I can summarise by user and number of sick periods. You can see how the rules work; periods of sickness are grouped together. Anyone got any ideas ? Thanks Damien . |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Struggling with MS Query... | Alex | General Discussion | 5 | July 6th, 2004 11:46 AM |
Countif with 2 or more data ranges in same column | Doug | Worksheet Functions | 1 | July 4th, 2004 08:57 AM |
Subreport 'pushes down' data next to it | Fred | Setting Up & Running Reports | 3 | June 30th, 2004 06:13 PM |
Newbie? Do I use Report or Query | John Egan | New Users | 11 | June 28th, 2004 08:31 PM |
How to graph adjacent data in column? | bmacwilliams | Charts and Charting | 1 | December 17th, 2003 12:39 AM |