反转数据库中的最后两个数据
Reverse the two last data from the database
我想反转下面查询显示的数据。 datetime_logged ASC
从 table 中获取前两个数据,而 datetime_logged DESC
获取后两个数据。就像现在一样,它打印了最后两个数据,但我想反转这些。
示例: data_temperature
数据 9.8
排在数据 10.3
之前。我想扭转这一点,所以 10.3
领先于 9.8
。
SELECT data_temperature, data_address_seo, datetime_logged
FROM weather
WHERE data_address_seo = 'street-28-postal-code-city-country'
ORDER BY datetime_logged DESC
LIMIT 2
我怎样才能做到这一点?
使用子查询:
SELECT t.*
FROM (SELECT data_temperature, data_address_seo, datetime_logged
FROM weather
WHERE data_address_seo = 'street-28-postal-code-city-country'
ORDER BY datetime_logged DESC
LIMIT 2
) t
ORDER BY datetime_logged;
我想反转下面查询显示的数据。 datetime_logged ASC
从 table 中获取前两个数据,而 datetime_logged DESC
获取后两个数据。就像现在一样,它打印了最后两个数据,但我想反转这些。
示例: data_temperature
数据 9.8
排在数据 10.3
之前。我想扭转这一点,所以 10.3
领先于 9.8
。
SELECT data_temperature, data_address_seo, datetime_logged
FROM weather
WHERE data_address_seo = 'street-28-postal-code-city-country'
ORDER BY datetime_logged DESC
LIMIT 2
我怎样才能做到这一点?
使用子查询:
SELECT t.*
FROM (SELECT data_temperature, data_address_seo, datetime_logged
FROM weather
WHERE data_address_seo = 'street-28-postal-code-city-country'
ORDER BY datetime_logged DESC
LIMIT 2
) t
ORDER BY datetime_logged;