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 > Database Server Software > MySQL > Trouble using sysdate in BETWEEN clause

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-10-09, 15:14
attrcat attrcat is offline
Registered User
 
Join Date: May 2009
Posts: 7
Trouble using sysdate in BETWEEN clause

The following query returns no results, when there should be many. Can anyone tell me what I'm doing wrong?

SELECT latitude, longitude
FROM data_hist
WHERE server_ts BETWEEN sysdate() AND sysdate() - 100000
ORDER BY server_ts ASC

Thanks in advance!
Reply With Quote
  #2 (permalink)  
Old 06-10-09, 15:36
mike_bike_kite mike_bike_kite is offline
vaguely human
 
Join Date: Jun 2007
Location: London
Posts: 2,519
Not sure what you mean by subtracting an integer (100000) from a date. You'd do better using the date_add function.

Mike
Reply With Quote
  #3 (permalink)  
Old 06-10-09, 15:47
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
Quote:
Originally Posted by attrcat
Can anyone tell me what I'm doing wrong?
it's hard to tell from what little information you've provided

please do a SHOW CREATE TABLE

also, i'm curious how a lat/long data point would be time-sensitive
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #4 (permalink)  
Old 06-10-09, 16:02
healdem healdem is online now
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,260
a lat/long reflects a physical co-ordinate which may have been recorded at a specific point in time as a position.

I don't see any problem in looking for positions over a specific date/time span.
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
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