I'm creating a database for a browser game. So far I was doing quite well (I guess) until I decided to make items stackable. Therefore, I created "quantity_table". This is my simplified database:
My goal is to get data of an item and quantity in one query. I tried something like this:
SELECT items.*, quantity_table.quantity1 FROM items JOIN quantity_table WHERE id_item = 3 AND id_quant = 1
Result:
It kinda worked... but if I select item no. 2 the last column would be quantity2. And I don't need quantityX columns, but something universal, like 'quantity'. So query is not the problem, but database itself. But I'm STUCK for good with this! Really do not know how to solve this problem. Could anybody help me?