If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > SELECT Statement Help

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-27-03, 17:52
jpvlvt jpvlvt is offline
Registered User
 
Join Date: Jun 2003
Posts: 2
SELECT Statement Help

Can someone please put me out of my misery?

I have a dataase containing the following fields

Year, Month, Day, Hour, data

and I need to write a query that will only get records in a certain date-time range (Between startHour and endHour, both of type Date). I am struggling to come up with a SELECT statement that will do this.

I'm working in VB under Excel accessing a ACCESS db using ADODB.

I'm thinking along the lines of

strSQL = "SELECT Year & ""/"" & Month & ""/"" & Day & "" "" & Hour -1 & "":00"" AS StartHour, Data FROM table WHERE ?????????????"

Please help
Reply With Quote
  #2 (permalink)  
Old 07-01-03, 13:07
blindman blindman is offline
World Class Flame Warrior
 
Join Date: Jun 2003
Location: Ohio
Posts: 11,726
In Access you can use the DateSerial function to convert your data to a microsoft date value. I'd recomment that you create and store a query that does this for you and then connect to the query from Microsoft Excel.
Reply With Quote
  #3 (permalink)  
Old 07-10-03, 18:43
aruneeshsalhotr aruneeshsalhotr is offline
Registered User
 
Join Date: Jul 2003
Location: US
Posts: 314
Arrow SQL query

Hi
I am sure I would be able to help with the date formatting, but could you please be a little more elaborate.

I understand u have a table with 5 fields (YYYY, MM, DD, HH, MI).

Now you want to get all the records between certain hour times of the day. Is that true.

Or it is like you want to concatenate the dates ??

It needs more elaborate explaination.
Thanx and Regards
Aruneesh
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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