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

LIMITING QUERY RESULTS !!

Status
Not open for further replies.

kingjjx

Programmer
Sep 18, 2001
181
0
0
US
Hi, I want to limit the query result of my page to only display fields with values. I have 50 fields and only 5 are required, however users can put values in all 50 fields. I want a query to return only the fields that have values in them.

How do i do write this ?? please help.

thank you
 
This may depend a little on the database, but in Oracle you'd

SELECT * FROM tableName
WHERE field1 IS NOT NULL

I think in Access you could also

SELECT * FROM tableName
WHERE field1 <> ''

John Hoarty
jhoarty@quickestore.com
 
Hey do i have to replace field1 with the field name ?
Do i go like this ... WHERE field1, field2, field 3 IS NOT NULL

thanks


 
Hi .. I tried using ..
WHERE field1, field2, field 3 ... IS NOT NULL .. and it doesnt work .. any help ?
thank you
 
Yes, you have to replace fieldname with the name of the database field you are querying. Another example:

SELECT DeptID, FirstName, Lastname
FROM EmployeeList
WHERE LastName IS NOT NULL

or

SELECT DeptID, FirstName, Lastname
FROM EmployeeList
WHERE LastName <> ''

John Hoarty
jhoarty@quickestore.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top