Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have tried to build an sql query to use in a Query Table.
It should be - select * where data = x or data = y and date <= date1 and = date2 what it appears to be doing is querying the date on data y but not on data x, if that makes sense. How can I select by two data types and then dates on all data selected??? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Logical "AND" is always performed before logical "OR" operators, therefore
your statment is working as if written like this: where data = x or (data = y and date <= date1 and = date2) try doing this: where (data = x or data = y) and date <= date1 and = date2 "westg" wrote: I have tried to build an sql query to use in a Query Table. It should be - select * where data = x or data = y and date <= date1 and = date2 what it appears to be doing is querying the date on data y but not on data x, if that makes sense. How can I select by two data types and then dates on all data selected??? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Also, it looks like something is missing...
where (data = x or data = y) and date <= date1 and DATE = date2 "Charlie" wrote: Logical "AND" is always performed before logical "OR" operators, therefore your statment is working as if written like this: where data = x or (data = y and date <= date1 and = date2) try doing this: where (data = x or data = y) and date <= date1 and = date2 "westg" wrote: I have tried to build an sql query to use in a Query Table. It should be - select * where data = x or data = y and date <= date1 and = date2 what it appears to be doing is querying the date on data y but not on data x, if that makes sense. How can I select by two data types and then dates on all data selected??? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi westg,
You may have to use parenthesis to group the items in your where clause: SELECT * FROM MyTable WHERE (Data=x OR Data=y) AND MyDate<=Date1 AND MyDate=Date2 -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] westg wrote: I have tried to build an sql query to use in a Query Table. It should be - select * where data = x or data = y and date <= date1 and = date2 what it appears to be doing is querying the date on data y but not on data x, if that makes sense. How can I select by two data types and then dates on all data selected??? |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I also have the same confussion, give me some idea about berween date query *** Sent via Developersdex http://www.developersdex.com *** |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Applying Criteria in Excel Cell to MS Query Pull from Access | Excel Discussion (Misc queries) | |||
Applying functions to web query results | Excel Discussion (Misc queries) | |||
IF statement query | Excel Worksheet Functions | |||
ms query - from statement | Excel Programming | |||
Use MS Query in VBA to only get a SQL statement | Excel Programming |