S_Shrum has asked for the wisdom of the Perl Monks concerning the following question:
More of an SQL question but it involves DBI. Specifically my question has to do with the * field identifier and the use of.
I'm attempting to construct a query to pass to DBI/AnyData/SQL:Statement to run on a database that contains all the content of my website. The db has roughly 15 or so fields in which all the document data is stored (author, creation date, abstract, etc). I'm trying to query all the fields in the database so that if, say, someone wanted to see all the documents that had the word 'sean' in *one or more* of the fields, they could search for it. I've tried:
...WHERE * CLIKE '%sean%'...
But that doesn't work; no results (bad syntax or incorrect logic?). The only way I've found so far that will allow me to get the results I want is to specifically go thru and list each field with a OR separator like:
...WHERE Title CLIKE '%sean%' OR Author CLIKE '%sean%' OR Created CLIKE...
Doesn't SQL:Statement support the * field identifier or am I setting this up wrong??? I rather not have to pass any field names if possible. Granted, I could query the data source for the column headers but this just seems like the long way of getting it to work. Also it makes the final SQL string huge which looks ugly when displayed to the user (if I opt to).
TIA
======================
Sean Shrum
http://www.shrum.net
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: DBI - Multi-field SQL: *OR* condition w/o specifying field names...possible?
by Arguile (Hermit) on Oct 05, 2002 at 04:39 UTC | |
Re: DBI - Multi-field SQL: *OR* condition w/o specifying field names...possible?
by screamingeagle (Curate) on Oct 05, 2002 at 01:55 UTC | |
by S_Shrum (Pilgrim) on Oct 05, 2002 at 05:29 UTC |