I've put together a Widget that monitors auction activity.
It hits my Rails app every 15 seconds, and returns the total amount
raised by the auction (top bid for each item x the number of items).
But I hate seeing this scroll by in my logs:
SELECT * FROM bids WHERE (item_id = 1 AND proxy != 1) ORDER BY amount
DESC, time DESC LIMIT 1
SELECT * FROM bids WHERE (item_id = 2 AND proxy != 1) ORDER BY amount
DESC, time DESC LIMIT 1
SELECT * FROM bids WHERE (item_id = 3 AND proxy != 1) ORDER BY amount
DESC, time DESC LIMIT 1
How would you guys refactor this? Can this be expressed as a single
query?
-- Patrick
_______________________________________________
Sdruby mailing list
[email protected]
http://lists.sdruby.com/mailman/listinfo/sdruby