August 8, 2012 at 8:37 am
Hi,
I have a Stored procedure with many instructions among which this one
select cmp_id from CSR_COMPLEMENT
where DOS_ID = (select DOS_ID from CSR_DOSSIER where DOS_NODE = @DOS_NODE) order by cmp_numordre
if the number of row is 01, i can easily get the cmp_id, now how can i get the cmp_id when the number of row is more than one? in this case the cmp_id to take is the one with the higher cmp_numordre. from the result, I writing a new sql.
thanks
August 8, 2012 at 8:41 am
select top 1 cmp_id from CSR_COMPLEMENT
where DOS_ID = (select DOS_ID from CSR_DOSSIER where DOS_NODE = @DOS_NODE) order by cmp_numordre desc
Might be missing something but if you only want 1 cmp_id based on the highest cmp_numordre, the above should work.
August 8, 2012 at 8:42 am
~ demonfox
___________________________________________________________________
Wondering what I would do next , when I am done with this one :ermm:
August 8, 2012 at 8:45 am
did I miss something ?
I guess i didn't get the question ...
~ demonfox
___________________________________________________________________
Wondering what I would do next , when I am done with this one :ermm:
August 8, 2012 at 8:45 am
hi,
MERCI
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply