我有一个对结果进行分组的 sql 查询。print_r 显示了我想要的结果。现在我想在表组中显示这些结果,即表一,其中包含该表的所有座位的列表,表二等。
我已经尝试了各种方法来完成这项工作,但无济于事......这是代码。我可以轻松地显示记录 - 但想按组显示它们 arghhh
$seatings = $wpdb->get_results("SELECT
bb_cl_seating.table,
bb_cl_seating.seat,
bb_cl_seating.seat_id,
bb_events_attendee.fname,
bb_events_attendee.lname,
bb_events_attendee.email
FROM bb_cl_seating
LEFT JOIN bb_events_attendee
ON bb_cl_seating.id = bb_events_attendee.id
WHERE bb_cl_seating.event_id = '1' ");
foreach ($seatings as $seating) {
} // Ends foreach