24 lines
842 B
PHP
24 lines
842 B
PHP
<?php
|
|
include "db.php";
|
|
|
|
$query = "SELECT hloh.school_num,school_name,hloh.schedule_num,ordered_by_num,order_total,added_date,sum(extended_price) " .
|
|
"FROM hotlunch_order_header AS hloh,hotlunch_order_items AS hloi, schools AS s " .
|
|
"WHERE hloh.ordered_by_type = 'Student' " .
|
|
"AND order_total = 0.00 " .
|
|
"AND hloh.record_num = hloi.order_num " .
|
|
"AND hloh.added_date > '2012-12-01' " .
|
|
"AND hloi.active != 'N' " .
|
|
"AND s.record_num = hloh.school_num " .
|
|
"group by 1,2,3,4,5,6 " .
|
|
"having sum(extended_price) > 0 " .
|
|
"order by 2,6";
|
|
$results = db_query($query);
|
|
if (db_num_rows($results)) {
|
|
while ($row = db_fetch_assoc($results)) {
|
|
print_r($row);
|
|
echo("================================================================\n\n");
|
|
}
|
|
}
|
|
|
|
?>
|