MySQL Concatenate and Compare
Like this blog? Consider exploring one of our sponsored banner ads...
Ever come across a database table where the date and time where two separate fields? How do you run comparisons against them? What if you need to get all records between Monday at 5pm and Tuesday at 2:30am?
You have to concatenate the fields before doing comparisons. In MySQL I found that this is extremely easy:
SELECT * FROM `table` where CONCAT(`date`,' ',`time`) between ‘2006-10-02 17:00:00′ AND ‘2006-10-03 02:30:00′
About this entry
You’re currently reading “MySQL Concatenate and Compare,” an entry on BRADINO
- Published:
- 3.24.07 / 9am
- Category:
- MySQL
- Tags:
No comments
Jump to comment form | comments rss [?] | trackback uri [?]