I currently have 2 tables
A table that stores all the different values(names) that can be stored in the other.
item_slots:
id | Name
items_list:
id | user_id | i_slot | Name
item_slots has 11 entries, whereas items_list can have infinite. During my query of items_list, it can return any amount of items based on the user_id.
I need to replace items_list.i_slot with item_slots.name based on the associated id in i_slot
I am trying the following:
SELECT il.* is.name
FROM items_list AS il
JOIN item_slots AS is
ON is.id = il.i_slot
WHERE il.user_id = 3
This returns the following error: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.name FROM items_list AS il JOIN item_slots AS is ON is.id = il.i_slot WHERE il' at line 1
isis a keyword in MySQL (as inIS NULLet al), try this (escaping the aliases)