Hello everyone,
I'm just wondering if the below is possible.
Let's say i have this table
+---------+-------+
| item_id | price |
+---------+-------+
| 14 | 1500 |
| 74 | 1500 |
| 78 | 2500 |
+---------+-------+
And I'd like to select all item_id within this array (14,78,14)....
I thought I would be able to get the sum of all prices with this select:
mysql> select SUM(price) from items_db where item_id in (14,78,14);
+-------+
| price |
+-------+
| 4000 |
+-------+
1 row in set (0.00 sec)
But obviously it just skipped the price for the duplicate item_id.
So is there any way I could make this work?
Thanks in advance, Alex