Ryan
2007-10-12 22:59:00 UTC
Can anyone please tell me how I can get the ins_id's to group so that the
dollar amounts sum up properly? My SQL and current out put is listed below.
SELECT i.ins_id, sum(p.pur_quantity) * t.tic_rate AS dollar
FROM tr_instances i INNER JOIN tr_events e ON i.eve_id = e.eve_id
LEFT OUTER JOIN tr_tickets t ON i.ins_id = t.ins_id
LEFT OUTER JOIN tr_purchases p ON t.tic_id = p.tic_id
GROUP BY i.ins_id, t.tic_rate
DOLLAR INS_ID
1 [empty string] 10003
2 45.0000 10000
3 [empty string] 10000
4 1260.0000 10001
5 [empty string] 10000
6 200.0000 10001
dollar amounts sum up properly? My SQL and current out put is listed below.
SELECT i.ins_id, sum(p.pur_quantity) * t.tic_rate AS dollar
FROM tr_instances i INNER JOIN tr_events e ON i.eve_id = e.eve_id
LEFT OUTER JOIN tr_tickets t ON i.ins_id = t.ins_id
LEFT OUTER JOIN tr_purchases p ON t.tic_id = p.tic_id
GROUP BY i.ins_id, t.tic_rate
DOLLAR INS_ID
1 [empty string] 10003
2 45.0000 10000
3 [empty string] 10000
4 1260.0000 10001
5 [empty string] 10000
6 200.0000 10001