ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   SQL ODBC MSQuery in EXCEL (https://www.excelbanter.com/excel-programming/426397-sql-odbc-msquery-excel.html)

mcarter

SQL ODBC MSQuery in EXCEL
 
I have an excel spreadsheet and want to import data from ODBC oracle table.
I had to write the SQL code because the query could not be shown
graphically...
and it does work successfully. The problem is that I want to include
criteria in the WHERE clause for BRICKDATE, but cannot get it to work...

SELECT AC_WC_DEMOG_CRSTAB.BRICKDATE, AC_WC_DEMOG_CRSTAB.STATE,
Sum(AC_WC_DEMOG_CRSTAB."DEC1-3_RECORD_COUNT") AS "DEC1-3_RECORD_COUNT
FROM (AC_WC_DEMOG_CRSTAB)
WHERE (AC_WC_DEMOG_CRSTAB.STATE='NY')
GROUP BY AC_WC_DEMOG_CRSTAB.BRICKDATE, AC_WC_DEMOG_CRSTAB.STATE

I have tried this code but does not work...
WHERE (AC_WC_DEMOG_CRSTAB.STATE='NY') AND
(AC_WC_DEMOG_CRSTAB.BRICKDATE='2008-06-01 00:00:00'))

the date that is used is the actual date in the field that was copy/pasted in.
I need the SQL code that will work in MSQuery from exel to ODBC table.
Thanks


All times are GMT +1. The time now is 07:19 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com