Files
HotLunches/sql1.txt
T
2026-10-19 15:22:52 -07:00

17 lines
1.2 KiB
Plaintext

select distinct p.people_type,hloi.ordered_by_num,p.first_name,p.last_name,p.label_note,p.class_num AS class_num,p.user_num,c.division,c.sequence,c.grade,hloi.order_num,p.class_num AS clnum, p.meal_location AS mlnum,hloh.added_date,hloh.paid_date,hloh.status,delivered
from hotlunch_order_header as hloh, hotlunch_order_items as hloi, hotlunch_menu_items as hlmi, people as p
left join classes as c on c.school_num = 20200 and p.class_num = c.record_num
left join people as p1 on c.teacher1 = p1.record_num
where hloh.record_num = hloi.order_num
and hloh.status not in ('Inactive','Deleted')
and hloi.ordered_by_num = p.record_num
and hloh.ordered_by_num = p.record_num
and hloi.school_num = 20200
and hlmi.school_num = 20200
and p.school_num = 20200
and p.status != 'Inactive'
and hloi.menu_item_num in (15529593,15529594,15529595,15529596,15529597,15529598,15529599,15529600,15529601,15529602,15529603,15529604,15529605,15529606,15529607,15529608,15529609,15529610,15529611,15529612,15529613,15529614,15529615,15529616,15529617,15529618,15529619,15529620,15529621,15529622,15529623,15529624,15529625,15529592,15529626,15529627,15529628)
and hloi.menu_item_num = hlmi.record_num
and hloi.active != 'N'
order by sequence,people_type desc,last_name,first_name