ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   help with sql in excel (https://www.excelbanter.com/excel-programming/271293-help-sql-excel.html)

aneurin

help with sql in excel
 
hi i have the below sql statement

"SELECT TRUNC(FORM_XD.DAY_OF_WEEK),
TO_CHAR(FORM_XD.DAY_OF_WEEK,'HH24:MI'), FORM_XD.TEAM, FORM_XD.TALK,
FORM_XD.SALES, FORM_XD.WAIT" & Chr(13) & "" & Chr(10) & "FROM
EASY.FORM_XD _FORM_XD" & Chr(13) & "" & Chr(10) & "WHERE
(FORM_XD.TEAM=20)" & Chr(13) & "" & Chr(10) & "ORDER BY
TRUNC(FORM_XD.DAY_OF_WEEK)"

it connect to the database to a table called form_xd
and only brings in the data where team = 20
the problem i am having is that i have to state this criteria in the
sql statement

what i would like to do is to get this criteria form a cell on sheet 1

hope someone can help

aneurin

Tom Ogilvy

help with sql in excel
 
"WHERE
(FORM_XD.TEAM=20)"

would be

"WHERE
(FORM_XD.TEAM=" & Worksheets("Sheet1").Range("A1").Value & ")"

--

Regards,
Tom Ogilvy

"aneurin" wrote in message
om...
hi i have the below sql statement

"SELECT TRUNC(FORM_XD.DAY_OF_WEEK),
TO_CHAR(FORM_XD.DAY_OF_WEEK,'HH24:MI'), FORM_XD.TEAM, FORM_XD.TALK,
FORM_XD.SALES, FORM_XD.WAIT" & Chr(13) & "" & Chr(10) & "FROM
EASY.FORM_XD _FORM_XD" & Chr(13) & "" & Chr(10) & "WHERE
(FORM_XD.TEAM=20)" & Chr(13) & "" & Chr(10) & "ORDER BY
TRUNC(FORM_XD.DAY_OF_WEEK)"

it connect to the database to a table called form_xd
and only brings in the data where team = 20
the problem i am having is that i have to state this criteria in the
sql statement

what i would like to do is to get this criteria form a cell on sheet 1

hope someone can help

aneurin





All times are GMT +1. The time now is 06:19 PM.

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