ODBC-coupling SQL questions

S

Sven

Hi,

We are uploading data from an Infoplus21 database using the ODBC coupling.
The data is:
- The fields are Name, A production number and the date-time
- The sampletime of the data is 1 minute in the Infoplus21 database - the
format of the time-date is"DD-MMM-YYYY hh:mm:ss" ( 12-Oct-2007 01:40:00 )

What I want is:
- I just want to have data of every 5 minutes or even better when the
production number changes => IP_PVDef_2.IP_TREND_CMMNT ( see SQL-string )
- The SQL-string looks like:
==
SELECT IP_PVDef_2.NAME, IP_PVDef_2.IP_TREND_CMMNT,
IP_PVDef_2.IP_TREND_CMMNT_TIME
FROM IP_PVDef_2 IP_PVDef_2
WHERE (IP_PVDef_2.NAME='06Lotnummer') AND
(IP_PVDef_2.IP_TREND_CMMNT_TIME>'01-dec-07 00:00:00' And
IP_PVDef_2.IP_TREND_CMMNT_TIME<'01-jan-08 00:00:00')
ORDER BY IP_PVDef_2.IP_TREND_CMMNT_TIME
==

How to change the SQL-string that it takes the 5 minutes or the change op
the IP_PVDef_2.IP_TREND_CMMNT into account?
I have my start and end date in my Excel-workbook, How can I link those
fields in my SQL-string?

thanks for your support
Sven
 
J

Jean-Yves

Hi,

Concatenate the SQL string with your variable using "&"

"SELECT IP_PVDef_2.NAME, IP_PVDef_2.IP_TREND_CMMNT, " & _
"IP_PVDef_2.IP_TREND_CMMNT_TIME " & _
"FROM IP_PVDef_2 IP_PVDef_2 " &
"WHERE (IP_PVDef_2.NAME='06Lotnummer') AND " & _
"(IP_PVDef_2.IP_TREND_CMMNT_TIME>'" & range(startteime) & "' And " & _
"IP_PVDef_2.IP_TREND_CMMNT_TIME<'& range(endtime) & "' )"& _
"ORDER BY IP_PVDef_2.IP_TREND_CMMNT_TIME"

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top