Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Pivot Table & Dates

I have the following query in microsoft query,

SELECT v_AnalogHistory.DateTime, v_AnalogHistory.TagName,
v_AnalogHistory.Value, v_AnalogHistory.wwRowCount
FROM Runtime.dbo.v_AnalogHistory v_AnalogHistory
WHERE (v_AnalogHistory.TagName='PS004_Pump1.Daily_Runtim e') AND
(v_AnalogHistory.DateTime={ts '2007-01-01 00:00:00'} And
v_AnalogHistory.DateTime<={ts '2007-01-14 23:59:59'}) OR
(v_AnalogHistory.TagName='PS004_Pump2.Daily_Runtim e') OR
(v_AnalogHistory.TagName='PS004_Pump1.Daily_Starts ') OR
(v_AnalogHistory.TagName='PS004_Pump2.Daily_Starts ')

what i would like to do is just grab the last 14 days of data..ie

v_AnalogHistory.DateTime=GetDate()
And v_AnalogHistory.DateTime<=GetDate()-14

is this possiable?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Pivot Table & Dates

What is GetDate? Is that a function you have written? In any case what you
need to do is to write the SQL using the native SQL of the database you are
connecting too. You can not use anything other than the native SQL commands.
if it is just the last 14 days that should be fairly easy to do.

--
HTH...

Jim Thomlinson


"Mark J" wrote:

I have the following query in microsoft query,

SELECT v_AnalogHistory.DateTime, v_AnalogHistory.TagName,
v_AnalogHistory.Value, v_AnalogHistory.wwRowCount
FROM Runtime.dbo.v_AnalogHistory v_AnalogHistory
WHERE (v_AnalogHistory.TagName='PS004_Pump1.Daily_Runtim e') AND
(v_AnalogHistory.DateTime={ts '2007-01-01 00:00:00'} And
v_AnalogHistory.DateTime<={ts '2007-01-14 23:59:59'}) OR
(v_AnalogHistory.TagName='PS004_Pump2.Daily_Runtim e') OR
(v_AnalogHistory.TagName='PS004_Pump1.Daily_Starts ') OR
(v_AnalogHistory.TagName='PS004_Pump2.Daily_Starts ')

what i would like to do is just grab the last 14 days of data..ie

v_AnalogHistory.DateTime=GetDate()
And v_AnalogHistory.DateTime<=GetDate()-14

is this possiable?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pivot Table Dates Liz J[_2_] Excel Discussion (Misc queries) 1 October 8th 09 12:08 AM
dates on pivot table not right Wanna Learn Excel Discussion (Misc queries) 4 August 6th 09 12:05 PM
Pivot Table and Pivot Table dates are not in correct order ls Charts and Charting in Excel 3 July 14th 09 04:02 PM
Dates in a pivot table Mick Henn[_2_] Excel Discussion (Misc queries) 0 May 7th 09 09:07 AM
Pivot Table Dates denhamlee Excel Discussion (Misc queries) 0 March 16th 07 02:57 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"