简体   繁体   中英

How to lookup value from a table and select it within the current table

I'm trying to lookup a value (c) from a table (Table2) and link it to a value (a) that I have in Table1. When I run the following lines I get an error "Unsupported subquery type cannot be evaluated". I don't know how to resolve it.

SELECT
    a,
    b,
    (SELECT c FROM Table2 AS T2 WHERE T1.a = T2.a) AS c,
FROM Table1 AS T1;

I tried different subquery types but couldn't find the solution.

SELECT T1.a, T1.b, T2.c
FROM Table1 as T1
JOIN Table2 AS T2
  ON T1.a = T2.a;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM