July 17, 2008 at 3:18 pm
india,1,987
unitedstates,2,987
uk,1,723
australia,2,723
pakistan,3,723
i have file like this, after reading it from the flatfile source i have 3 colums
NAME,SUB-SEQNO,Serial No
i need
unitedstates,2,987
pakistan,3,723
i mean the latest ones should be there in the destination columns.
can anyone help me with this
how to solve this?
July 17, 2008 at 4:07 pm
i mean the latest ones should be there in the destination columns
What defines the latest ones?
Is it the column SUB-SEQNO value
or
Serial No values
or
some combination of SUB-SEQNO values and Serial No value
and what T-SQL code did you attempt to use to do this?
July 17, 2008 at 9:45 pm
india,1,987
unitedstates,2,987
uk,1,723
australia,2,723
pakistan,3,723
if you look at the above data, i need the last record in that serial no
like
india, 1 , 987
unitedstates, 2 , 987
so according to above discussion i need unitedstates,2,987
uk,1,723
australia,2,723
pakistan,3,723
for this i need pakistan,3,723.
July 18, 2008 at 11:25 am
its like our script component look for the serial no then look for the subseq no then output the highest subseqno row of that serial number.
Please help me out
July 18, 2008 at 3:45 pm
Try this:
SELECT Name, MAX(Subsqno),SerialNo FROM TbL01 GROUP BY NAME,SerialNo HAVING COUNT(Name) = 1
UNION
SELECT Name, MAX(Subsqno), SerialNo FROM TbL01 GROUP BY NAME,SerialNo HAVING COUNT(Name) > 1
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply