0

hi am raj!
am a asp , sql server 2000 programmer

i need a sql query to select unique rows based on noofcards,versionno,id here am giving the database
-------------------------------------------
id email ccno vno nc
-------------------------------------------
41 b@r.com f 2465 1 1
41 b@r.com f 9898 1 3
41 b@r.com a 9898 1 2
41 b@r.com f 2465 2 1
41 b@r.com e 6226 2 2
41 b@r.com s 2465 3 1
------------------------------------------
ccno = creditcardno
vno = versionno
no = noofcard

the o/p i should get is
-------------------------------------------
id email ccno vno nc
-------------------------------------------
41 b@r.com f 3554 1 3
41 b@r.com e 6226 2 2
41 b@r.com s 2465 3 1
------------------------------------------

i tryed this query
select * from creditcardinfo where versionno =(select max(versionno) from creditcardinfo where id =41)

but am getting only one row with the maxversionno

41 b@r.com s 2465 3 1

so, pleas help me in getting the row i 've specified above.

any help will be appreciated.

2
Contributors
1
Reply
2
Views
10 Years
Discussion Span
Last Post by Ramy Mahrous
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.