I try to combine data from 2 tables by a mysql join but I look likes, I don’t receive the results from the second table at all.
Table structre #1 (site_hosters);
+------------+--------------+--------+
| host_id | name | prio |
+------------+--------------+--------+
| 1 | site.com | 0 |
+------------+--------------+--------+
Table structure #2 (site_date);
+------------+--------------+--------+
| id | hoster | page |
+------------+--------------+--------+
| 1 | site.com | http:..|
+------------+--------------+--------+
What I try to get is a result like ‘id, host_id, name, ….etc’;
When I try the follow query, it doesn’t take host_id and prio in the query result.
It looks, the join has no effect at all by query it.
My query:
SELECT
site.id,
site.hoster,
site.page,
FROM site_data as site
INNER JOIN site_hosters hoster
ON site.hoster = hoster.name
I hope someone can help me with this one.
Kind regards,
Nick
You have to name the columns you want to select. Add the
site_hosterscolumns like that: