is possible obtain records of the min id and grouped by a column? (in 4.0)
SELECT period, activity, date
FROM (
SELECT MIN(id) id
FROM Booking
WHERE place = 'CONFERENCE'
AND Date = '05 - Mar'
GROUP BY period
) A
INNER JOIN Booking B
USING (id) ORDER BY id
is possible equivalent to version 4.0?
I think the following gets the min of the id without a subquery:
select b1.period, b1.activity, b1.date
from booking b1 cross join
booking b2
group by b1.id, b2.period
having b1.id = min(b2.id)
You can apply your where
conditions as:
select b1.period, b1.activity, b1.date
from booking b1 cross join
booking b2
where b2.place = 'CONFERENCE' and
b2.Date = '05 - Mar'
group by b1.id, b2.period
having b1.id = min(b2.id);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.