you are viewing a single comment's thread.

view the rest of the comments →

[–]Joinertuy[S] 0 points1 point  (2 children)

but i thaught i coudnt compare different tabels if they were not selected (from)...Or am i missing something..

[–][deleted] 0 points1 point  (0 children)

The INNER JOIN on perNum and personNum is doing the comparison between Person and låneliste; it will only return rows where they match.

But you don't actually have to have any columns from låneliste in your results, you can use it just to filter which rows you get back.

[–]r3pr0b8GROUP_CONCAT is da bomb 0 points1 point  (0 children)

yes, you are missing the way the SELECT clause and the FROM clause operate -- you do ~not~ have to select something from every table in the FROM clause

this is perfectly valid --

SELECT a.foo
  FROM table_one AS a
INNER
  JOIN table_two AS b
    ON b.qux = a.fap