Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- +-------------+--------------+------+-----+---------+----------------+
- | Field | Type | Null | Key | Default | Extra |
- +-------------+--------------+------+-----+---------+----------------+
- | id | bigint(20) | NO | PRI | NULL | auto_increment |
- | location_id | bigint(20) | YES | MUL | NULL | |
- | price | double | NO | | NULL | |
- | start_date | datetime | NO | | NULL | |
- +-------------+--------------+------+-----+---------+----------------+
- select * from rate r INNER JOIN (SELECT r2.start_date,r2.id as
- id,r2.location_id, min(ABS(DATEDIFF(r2.start_date, NOW()))) AS version FROM rate r2
- GROUP BY r2.location_id) o2 ON ( o2.id=r.id and r.start_date=o2.start_date);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement