Need hourly update using SQL statement.

J

Jim Ferguson

I use a macro witin a Excel speadsheet to run an SQL query which returns data
back to Excel.
I want to get more info from my database by returning hprod every hour to
help determine hourly running efficency.
At present I can get a true running effficiency for the days running but
want to be able to separate into hourly segments for analsys. How can I
return hprod every hour to a different cell within my spread sheet. at
present the database does not timestamp anything that I can find so want to
use SQL to return data on the hour.

Below is query called from macro

SELECT WorkData.hstat, WorkData.hprod, WorkData.MLINE, WorkData.MBDESC,
WorkData.MBTYPE, WorkData.MMTYPE, WorkData.MQTY, WorkData.MLANE
FROM database.dbo.WorkData WorkData
WHERE (WorkData.MLINE Between 1 And 20) AND (WorkData.hstat<>'?')
ORDER BY WorkData.MBTYPE, WorkData.MBDESC, WorkData.MMTYPE

hstat has 3 possibles ('Y' or 'C' or '?')
Y = complete
C = running
? = waiting to run.

I am a novice with macros and SQL.
Thank you in advance for any help.
 

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

Similar Threads


Top