I am having some problems, trying to get data from my database, and show it correctly. I have a layout, where I have two \"lists\", where I can add rows to each lists. I can add
If you run a SQL query and you want the results in a particular order, then ALWAYS include an order by
clause.
In your case, you seem to want:
SELECT dl.id, dl.list_id, dl.date, dl.list_name,
dls.*
FROM driving_lists dl LEFT JOIN
driving_list_shipments dls
ON dl.list_id = dls.list_id
ORDER BY dl.list_id;
I assume that list_id
is what you mean by list_id
.
I should note that you have list_id
appearing twice in the SELECT
, because it is in both tables. You should probably explicitly list the columns you want from both tables, and avoid redundant columns.