SQL Question

CrazyCanuck

Registered User.
Local time
Today, 17:27
Joined
Sep 23, 2003
Messages
10
I'm doing an sql query on a Access Query.
I have no problem searching each record individually.
SELECT * from QrySearchall where QrySearchAll.Topic1 like "*hello*"
How can I make a full search where instead of Topic1 it searches for a match from every field?
 
If you want to return all records, just omit the where clause:
SELECT * from QrySearchall
but at that point, you're just looking at using the QrySearchall itself and you can usually just reference the stored query name itself.

If you're looking to match against more than the Topic1 field, use " And " or " Or " to string along more critieria.
 
Last edited:
So if I have 20 fields and I want to search all fields for a matching word I have to:
WHERE QrySearchALL.Topic1 like "*test*" AND QrySearchALL.Topic2 like "*test*" AND QrySearchALL.Topic3 like "*test*" AND QrySearchALL.Topic4 like "*test*" AND etc...?

Is there no way to just say search all columns in QrySearchALL for "test"?
 
No. Relational databases do not provide functions that work on the columns of a row as spreadsheets do since relational tables are NOT spreadsheets. Your problem is faulty design concepts. Do some reading on normalization and database design.
 

Users who are viewing this thread

Back
Top Bottom