MySQL Forums
Forum List  »  Newbie

Re: Date/Time Query
Posted by: Rick James
Date: April 11, 2009 10:32PM

I'll agree with Mark. And suggest two ways:

1. Write a program to read the csv, massage the data, then INSERT.

2. Insert the CSV data as-is. Then have SQL statements (and possible some code) massage the data, putting the cleansed data into another table.

I recommend you use a DOUBLE field for the date and time (call it tim). Take the part before the decimal point, convert to a UNIX_TIMESTAMP, then add the fractional part. This will fit nicely in a DOUBLE. Then, when you need decide if an item is, say, between 4pm and 5pm, do something messy like:
TIME(FLOOR(tim)) >= 1600
AND
TIME(CEIL(tim)) < 1700
(Caveat: there are probably multiple mistakes in my suggestion, but I hope you get the idea.)

Options: ReplyQuote


Subject
Written By
Posted
April 09, 2009 08:08AM
April 09, 2009 08:25AM
April 09, 2009 08:31AM
April 09, 2009 09:14AM
April 09, 2009 11:14AM
Re: Date/Time Query
April 11, 2009 10:32PM
April 13, 2009 01:19PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.