我有两张桌子:
tickets
ticket_id, int(11), NO, PRI, , auto_increment
order_num, varchar(45), NO, , ,
user_id, int(11), YES, , ,
event_id, int(11), YES, , ,
number_of_tickets, varchar(4), YES, , ,
order_placed, timestamp, NO, , CURRENT_TIMESTAMP,
payment_recd, enum('Yes','No'), YES, , No,
payment_time, timestamp, YES, , ,
events
event_id, int(11), NO, PRI, , auto_increment
venue_id, int(11), YES, , ,
event_date, date, YES, , ,
event_time, time, YES, , ,
event_price, decimal(4,2), YES, , ,
event_capacity, int(11), YES, , ,
dateadded, timestamp, NO, , CURRENT_TIMESTAMP,
我需要列出用户购买的门票并按活动日期订购,但我正在尝试的以下操作没有正确排序
select tickets.order_num as ordnum, tickets.event_id as tickid, tickets.number_of_tickets as numtix
from tickets, events
where ((tickets.user_id = '1') and (tickets.payment_recd = 'Yes'))
group by tickets.order_num
order by events.event_date asc
有任何想法吗?