Forums

This topic is locked

query for multiple fields doesent work

Posted 06 Jul 2007 12:15:34
1
has voted
06 Jul 2007 12:15:34 davide aldrighetti posted:
Ive a problem with Dreamweaver and SQL query.
This query works:

SELECT *
FROM table
WHERE table.field1 LIKE %MMColParam%


But if i try to extend to two or more fields the WHERE function with OR, like the following query, i receive a syntax error!

SELECT *
FROM table
WHERE table.field1 LIKE %MMColParam% OR table.field2 LIKE %MMColParam%

Whats the right syntax format for this type of query?

Thanx a lot

Replies

Replied 09 Jul 2007 13:25:06
09 Jul 2007 13:25:06 Georgi Kralev replied:
Hi Davide,

Try the following syntax:

SELECT *
FROM table
WHERE (field1 LIKE '%Value%') OR (field2 LIKE '%Value%')

Replace Value with the actual value and make sure field1 and field2 exist in your table.


Georgi Kralev

----------------------------------
Support - www.DMXzone.com

Reply to this topic