0
Recordset SQL: help for a WHERE with multiple fields
New Here
,
/t5/dreamweaver-discussions/recordset-sql-help-for-a-where-with-multiple-fields/td-p/309714
Jul 09, 2007
Jul 09, 2007
Copy link to clipboard
Copied
Ive a problem with Dreamweaver and SQL query.
This query works:
SELECT *
FROM table
WHERE table.field1 LIKE %MMColParam%
The MMColParam is a Request.Form("variable") from a previous form in ASP page.
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
This query works:
SELECT *
FROM table
WHERE table.field1 LIKE %MMColParam%
The MMColParam is a Request.Form("variable") from a previous form in ASP page.
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
TOPICS
Server side applications
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

/t5/dreamweaver-discussions/recordset-sql-help-for-a-where-with-multiple-fields/m-p/309715#M99021
Jul 09, 2007
Jul 09, 2007
Copy link to clipboard
Copied
maybe depends on the database you use
possible solution:
SELECT *
FROM table
WHERE table.field1 LIKE '%' + MMColParam + '%' OR table.field2 LIKE '%' + MMColParam + '%'
hope this helps
sebastian
possible solution:
SELECT *
FROM table
WHERE table.field1 LIKE '%' + MMColParam + '%' OR table.field2 LIKE '%' + MMColParam + '%'
hope this helps
sebastian
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/dreamweaver-discussions/recordset-sql-help-for-a-where-with-multiple-fields/m-p/309716#M99022
Jul 09, 2007
Jul 09, 2007
Copy link to clipboard
Copied
Not sure which db but try adding ('s as below
SELECT *
FROM table
WHERE (table.field1 LIKE %MMColParam%) OR (table.field2 LIKE
%MMColParam%)
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
LATEST
/t5/dreamweaver-discussions/recordset-sql-help-for-a-where-with-multiple-fields/m-p/309717#M99023
Jul 09, 2007
Jul 09, 2007
Copy link to clipboard
Copied
Syntax errors are often caused by incorrect field types.
Check that both
database fields are exactly the same type.
--
Paul Whitham
Certified Dreamweaver MX2004 Professional
Adobe Community Expert - Dreamweaver
Valleybiz Internet Design
www.valleybiz.net
"promastermz" <webforumsuser@macromedia.com> wrote in message
news:f6sqap$399$1@forums.macromedia.com...
> Ive a problem with Dreamweaver and SQL query.
> This query works:
>
> SELECT *
> FROM table
> WHERE table.field1 LIKE %MMColParam%
>
> The MMColParam is a Request.Form("variable") from a previous form in ASP
> page.
> 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
>
>
database fields are exactly the same type.
--
Paul Whitham
Certified Dreamweaver MX2004 Professional
Adobe Community Expert - Dreamweaver
Valleybiz Internet Design
www.valleybiz.net
"promastermz" <webforumsuser@macromedia.com> wrote in message
news:f6sqap$399$1@forums.macromedia.com...
> Ive a problem with Dreamweaver and SQL query.
> This query works:
>
> SELECT *
> FROM table
> WHERE table.field1 LIKE %MMColParam%
>
> The MMColParam is a Request.Form("variable") from a previous form in ASP
> page.
> 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
>
>
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

