SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
SELECT e.item_code, game_items, COUNT(transaction_id) AS abs_count, ROUND(COUNT(transaction_id)::numeric * 100/ (SELECT COUNT(transaction_id) FROM fantasy.events),2) AS rel_count, (SELECT COUNT(id) FROM fantasy.events WHERE (SELECT SUM(item_code) FROM fantasy.events) = 1) AS abc FROM fantasy.events AS e INNER JOIN fantasy.items AS i ON e.item_code = i.item_code WHERE amount <> 0 GROUP BY e.item_code, game_items ORDER BY abs_count DESC

Stuck with a problem? Got Error? Ask ChatGPT!

Copy Clear