View Full Version : Help with SQL query...
CiscoKid
10-16-05, 04:39 PM
How can I setup a query to search multiple feilds in a table?
I have it working with only feild, but I would like it more refined.
Since it's for a real estate site, I'd like the search perameters to berefined down to the city, number of bedrooms, number of bathrooms and so on...
cyberskye
10-16-05, 06:12 PM
depending on the DBMS and interpreter, you may need to use quotes in the query.
SELECT * FROM tablename
WHERE field1 = x AND field2 = y AND field3 = z
Above assumes all data is in one table. You can do the same across multiple tables using a JOIN statement.
How can I setup a query to search multiple feilds in a table?
I have it working with only feild, but I would like it more refined.
Since it's for a real estate site, I'd like the search perameters to berefined down to the city, number of bedrooms, number of bathrooms and so on...
CiscoKid
10-16-05, 07:31 PM
Thanks, I dunno what was wrog...but that's what I had three days ago that didn't work...but now it does...? weird...
cyberskye
10-17-05, 07:53 PM
BTW - you get the best performance by using the most discrete field first - the one most likely to be unique.
vBulletin® v3.7.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.