Kevz
-
Posts
2 -
Joined
-
Last visited
Posts posted by Kevz
-
-
Creating a shopping list app, i have a drop down to display the location of the item or meal
dishes table
id | dish | items | locationid
:--------|:--------:|---------:|---------:
1| fajitas | chicken,wraps | 1
2| curry| chicken,tomatos | 1
2| | mayonaise | 2location table
id | location
:--------|:--------:
1| meal
2| fridgedisplaying items with this query
SELECT * FROM dishes LEFT JOIN location ON dishes.locationid = location.id ORDER BY dish ASC"
however now, it's taking the locationid, and using that as the dish id, so things like edit are broken as it's grabbing the wrong ID, am i using the wrong join clause?
MySQL Join breaking
in MySQL Help
Posted
yeah sorry that was just typo on here.
i fixed it with this query instead
SELECT d.id,d.dish,d.items,d.locationid,d.inlist,l.location FROM dishes AS d LEFT JOIN location AS l ON d.locationid = l.id ORDER BY dish ASC
thank you, why shouldn't i store as comma seperated?