Re: sql question
- From: Adamz5 <adamz5@xxxxxxxxxxx>
- Date: Thu, 17 Jan 2008 06:51:24 -0800 (PST)
Naughty boy!!!!
Normalise your data!!!!
so your table would have a the following 4 fields
Unique Key / ColKey / C1 / d1
Example
1 1 1 01/jan/2008
2 1 5 02/jan/2008
3 1 10 10/Jan/2008
4 2 4 01/jan/2008
5 2 NULL NULL
6 2 NULL NULL
them simply qry the above table as below:
select f.colkey, f.col1,f.col2
from
(select colkey, min(col2) as col2
from Table where col1 is not null group by colkey
) as x inner join Table f on f.colkey = x.colkey and f.col2 = x.col2
if you have sql 2005 you can easily use CTE
Hope this helps
Regards
Adam Issat
.
- Follow-Ups:
- Re: sql question
- From: Adamz5
- Re: sql question
- Prev by Date: (newbie) standalone app design criteria?
- Next by Date: VS2005Express: Deployment in a windows domain
- Previous by thread: Re: sql question
- Next by thread: Re: sql question
- Index(es):