SQL Questiongreenspun.com : LUSENET : SQL Server Database Administration : One Thread
If I had these items to search: Year, Make, Model, Style, Color, Price, Dealer
And I wanted to query any combination of and only of including skipping one of: Year, Make, Model
The way I have it now is: SELECT Year, Make, Model, Style, Color, Special, Price, Dealer FROM Pinellas WHERE Year = '%%Year%%' OR Make = '%%Make%%' OR Model = '%%Model%%'
This works fine untill I skip for example YEAR then it says no records found. I guess the questions is what would be a wildcard for YEAR to return all if NULL?
This is in Frontpage/Access97 Thanks, Luke Barnes firstname.lastname@example.org
-- Anonymous, May 26, 1999
I think you want to use the keyword LIKE in your WHERE clause. If that doesn't work try rewriting the query using IFs so that you have different WHERE clauses when Year, Make, and Model are null.
Hope this helps,
-- Anonymous, June 04, 1999