Query many in one row
I am new in SQL and I need solution for next problem:
Suppose we have table T1 with next values
Person Date Value
Smith 07/23/2007 A
Regan 04/12/2007 B
Cole 07/24/2007 C
Gigs 01/13/2007 D
Smith 08/14/2007 B
Regan 05/06/2007 C
Gigs 09/03/2007 A
Smith 12/23/2007 A
This table can conatin any Value (among A,B,C,D), for any Person in any Date in year 2007.
If row exists for person it must have value (A,B,C or D).
One person can have only one row for same date. For any date we can have values for 0,1 or more
persons. Not all dates in year 2007 are in T1, some can be without any data.
2) SECOND: I want to generate next report for one month, for example July (07) 2007:
Person Day01 Day02 ... Day23 Day24 ... Day31
Smith - - - A - ... -
Regan - - - - - ... -
Cole - - - - C ... -
Gigs - - - - - ... -
Off course in real life there can be more data for other persons in july.
I need SELECT or other statement(s) which will produce data as input for report. Or it must be done using some temp table, or ... ?
Thanks in advance.
|All times are GMT +5.5. The time now is 05:17.|