Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL -Distinct?

Status
Not open for further replies.

vbmorton

Technical User
Dec 27, 2004
44
US
Thought I would post to see if anyone had any ideas of how to do the following.

i have this sql statment connecting to as400.
Code:
 Set rsNewTravelers = New Recordset
 
    
 strsql = "select dtdept, dtrsrc, dtjobr, dtseq#, dtpart from " & g_strDataBase & ".CURPX1, " & g_strDataBase & ".CJOBH where dtjobr = dnjob and dnprnt <> 'Y'"


 rsNewTravelers.Open strsql, g_Conn

This code works but I would like to make it distinct by dtjobr.


Thanks
 
Yes, very good, I know it is a SQL question, but it is SQL that i wrote in my VB6 program. I was just wondering if anyone might have any ideas to change my SQL statment so that i can have less VB code later in my program weeding out the duplicates.
 
For Access and SQL server you could try,

"Select Distinct ...."

But as Frederico mentioned it all depend on your DB and whether it support the use of the distinct keyword.

zemp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top