简体   繁体   中英

Query to select a row from a table from another using id

I have two tables A and B. A has columns a,b,c,d,e,f and B has columns a and g. How can I get the row from table A according to the value of 'a' from Table B?

Try simple join query

Select A.a From A inner join B on A.a=B.a

if need extra condition

Select A.a From A inner join B on A.a=B.a where B.a=?

Try this:

SELECT a.a, a.b, a.c, a.d, a.e, a.f, b.g
FROM A a,
INNER JOIN B b ON a.a = b.a
WHERE a.a = b.a

These are the basics of SQL, next time try to read up on the basics first. You can go here W3SCOOLS if you want to learn.

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