I'm trying to do the below.
Table A
Name ID
Table B
ID Remark
Select Table B Remark based on Table A Name.
Use Name to get ID in table A then match ID in table B to get Remark from Table B.
Is this possible please?
You can use where exists
select remark from tableB b where exists (select 1 from tableA a where a.name= [give_name] and a.id=b.id);
or in
select remark from tableB b where b.id in (select id from tableA where name = [give_name]);
You can use a JOIN
SELECT remark FROM tableB b
JOIN tableA a ON a.ID = b.ID
WHERE a.name = ?
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.