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

Problem selecting SQL records only if specified field is not null. 2

Status
Not open for further replies.

cdck

Programmer
Nov 25, 2003
281
US
I'm trying to program a page to display tracking information for customer orders, and I'm having trouble getting a record to display only if the track field in that record is not null.

I've tried to deal with this in the display after the records are selected, but can't seem to get it to work - I'd really like to know how to only select the record in the first place if the track field isn't null.

My current select statement goes:

mySQL="SELECT tracking, notetime FROM tracking WHERE orderid like " & orderid & " ORDER BY noteTime"

I assume that I need to add an AND to the WHERE, but am not sure of the proper syntax to compare track to null.

Cheryl dc Kern
 
Code:
mySQL="SELECT tracking, notetime FROM tracking WHERE (orderid like " & orderid & " AND track_fiemd IS NOT NULL) ORDER BY noteTime"
 
How about

mySQL="SELECT tracking, notetime FROM tracking WHERE orderid like " & orderid & " and tracking is not null ORDER BY noteTime
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top