Using parentheses in an SQL query 
Author Message
 Using parentheses in an SQL query

Hi,

I am trying to create a query (for use with the built-in RB database)
that looks like this:

select * from table where (name = "Peter" or name = "Joe") and (date =
"2002-02-12" or date = "2002-02-13")

The problem seems to be the use of parentheses to override the normal
operator precedence. RB returns an error saying it expects a
table/column name instead of the first opening "(".

Is there a trick?

Thanks!

Daniel Tapie
Brussels, Belgium

--
Posted via Mailgate.ORG Server - http://www.*-*-*.com/



Tue, 10 Aug 2004 22:05:27 GMT  
 Using parentheses in an SQL query
Umm.. Have you tried the following?

select * from table where (name='Peter') or (name='Joe') and
(date='2002-02-12') or (date='2002-02-13')

Mark


Quote:
> Hi,

> I am trying to create a query (for use with the built-in RB database)
> that looks like this:

> select * from table where (name = "Peter" or name = "Joe") and (date =
> "2002-02-12" or date = "2002-02-13")

> The problem seems to be the use of parentheses to override the normal
> operator precedence. RB returns an error saying it expects a
> table/column name instead of the first opening "(".

> Is there a trick?

> Thanks!

> Daniel Tapie
> Brussels, Belgium

> --
> Posted via Mailgate.ORG Server - http://www.Mailgate.ORG



Tue, 10 Aug 2004 22:35:43 GMT  
 Using parentheses in an SQL query

Quote:
> Umm.. Have you tried the following?

> select * from table where (name='Peter') or (name='Joe') and
> (date='2002-02-12') or (date='2002-02-13')

Yes and it refuses any parenthese even the first one.

In addition, that would not solve my problem because  I need to change
the operator precedence.

We'll keep looking...

Daniel Tapie
Brussels, Belgium

--
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG



Tue, 10 Aug 2004 23:17:54 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. clipper query conver to sql query

2. Use of parentheses in an SQLSelect query

3. less parentheses --> fewer parentheses

4. less parentheses --> fewer parentheses

5. Dangling Closing Parentheses vs. Stacked Closing Parentheses

6. data to sql server using labview and labview sql toolkit

7. how to access SQL server using SQL toolkit from LabVIEW

8. Using SQL Anywhere (Watcom SQL 5.0) with REXX

9. Using SQL Anywhere (Watcom SQL 5.0) with REXX

10. MySQL query in PHP: Not query zero amounts also removes null amounts from query

11. extracting sql query result from ordered collection

12. re SQL Server Database queries

 

 
Powered by phpBB® Forum Software