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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

asp or sql solution? 1

Status
Not open for further replies.

travmak

Programmer
Apr 26, 2002
133
US
in my table I have two fields: partnumber and employeenum

I am trying to make a report that displays the partnumber where employeenum = '' no problem I got that part. the problem I have is this:

partnumber employeenum
1111 1
1112
1112 2
1113
1114 3

my page at this time gives me a recordset of:

partnumber employeenum
1112
1113

however 1112 has a later entery with an employeenum so I don't want that one, just 1113 because it doesn't have an employeenum.

my sql is currently:

sql_unaccounted = "select * from tbl_Inventory where employeenum = '' order by partnumber"

please help
 
If you only want one instance of each partnumber where it doesn't have an employeenumber associated with it then you could use the DISTINCT keyword.

sql_unaccounted = "select DISTINCT partnumber from tbl_Inventory where employeenum = '' order by partnumber"

I 'think' this will work

regards

Tony
 
It didn't work. I'm only getting one instance now (because their are not any douplicate numbers where employeenum = ''.)

 
Try something like:

sql_unaccounted = "select * from tbl_Inventory where employeenum = '' and partnumber not in (select partnumber from tbl_Inventory where employeenum != '') order by partnumber"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top