MySQL Forums
Forum List  »  Newbie

Query table for the last 268 entries (timedate) for specific rows types
Posted by: Terry Rauch
Date: January 24, 2018 02:32PM

I have the following query but instead of grabbing the last 7 days of data for specific row entires I would like to get the last 268 entries (1 entry each hour X 7 DAYS). Any help would be greatly appreciated.

SELECT
tb0.date date,tb0.value value_0,tb1.value value_1 FROM
(SELECT
a0.date date,a0.value value,a0.leaders leaders FROM
head2head a0 WHERE
a0.leaders='issue1' AND a0.date BETWEEN DATE(NOW() - INTERVAL 7 DAY) AND NOW() ) tb0
LEFT JOIN
(SELECT
a1.date date,a1.value value,a1.leaders leaders FROM
head2head a1 WHERE
a1.leaders='issue2' AND a1.date BETWEEN DATE(NOW() - INTERVAL 7 DAY) AND NOW() ) tb1 on (tb0.date=tb1.date)
WHERE 1

Options: ReplyQuote


Subject
Written By
Posted
Query table for the last 268 entries (timedate) for specific rows types
January 24, 2018 02:32PM


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.