User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MS SQL section within the Web Development category of DaniWeb, a massive community of 455,973 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,828 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MS SQL advertiser: Programming Forums
Views: 923 | Replies: 1
Reply
Join Date: Nov 2007
Posts: 1
Reputation: amuluri is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
amuluri amuluri is offline Offline
Newbie Poster

Help select query

  #1  
Nov 26th, 2007
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.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2006
Location: Egypt
Posts: 763
Reputation: RamyMahrous is on a distinguished road 
Rep Power: 4
Solved Threads: 59
Featured Poster
RamyMahrous's Avatar
RamyMahrous RamyMahrous is offline Offline
Master Poster

Re: select query

  #2  
Dec 5th, 2007
SELECT distinct(ccno) FROM creditcardinfo
Anything just ask!
B.Sc Computer Science, Helwan University
Microsoft Student Partner
Personal blog http://ramymahrous.blogspot.com/
Arabic technical blog http://fci-h-ar.blogspot.com/
English technical blog http://fci-h.blogspot.com/
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb MS SQL Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the MS SQL Forum

All times are GMT -4. The time now is 9:14 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC