Hi there...
I am developing a website that needs to do the following: When a user search for someone on the DB, it should look in the SURNAME collumn AND in the FIRSTNAME collumn for any matches. Like, if someone types the surname without the firstname, it should display the record(s) containing the surname AND vice versa.
My SQL is as follows:
Like the SQL stated above, it displays ALL the records and won't even filter something... When using AND instead of OR it displays nothing...

AND when I change my WHERE clause to:
it gives me a Syntax error.... Soooooo.... I am new to MSSQL combined with ASP. MySQL worked alot easier, but am forced to do MSSQL (MS Access type)
Any help would be MUCH appreciated...
I am developing a website that needs to do the following: When a user search for someone on the DB, it should look in the SURNAME collumn AND in the FIRSTNAME collumn for any matches. Like, if someone types the surname without the firstname, it should display the record(s) containing the surname AND vice versa.
My SQL is as follows:
Code:
SELECT *
FROM contacts
WHERE [Surname] OR [FirstName] = %MMColParam%
Like the SQL stated above, it displays ALL the records and won't even filter something... When using AND instead of OR it displays nothing...
AND when I change my WHERE clause to:
Code:
WHERE [Surname] = %MMColParam% OR [FirstName] = %MMColParam%
Any help would be MUCH appreciated...