Simple SQL Select from 2 Tables (What is a Join?)

后端 未结 2 463
有刺的猬
有刺的猬 2020-12-04 00:56

I\'m new to SQL. I have a simple problem with getting the results from two different tables.

I have two tables in a database. The first table has a column with an id

2条回答
  •  执念已碎
    2020-12-04 01:43

    You want a JOIN:

    SELECT
        u.id,
        username,
        groupname
    FROM
        TABLE_USERS AS u
    LEFT JOIN TABLE_GROUPS AS g
        ON u.group = g.id
    

提交回复
热议问题