I have two select query statements. I dont know to create table here.
Below are two tables. Id is same, but Fname and Lname is different.
Table1 have two columns
id Fname
1 Ahila
Table2 have two columns
id Lname
1 Kavitha
Output table should be single row with id and Fname and Lname : 1 and Ahila and Kavitha respectively
Please help me on this.
you need to use a join to join the two tables together, something like:
select t1.id, t1.Fname, t2.Lname
from Table1 t1
inner join Table2 t2 on t1.id = t2.id
Use JOIN statement
SELECT T1.id id , T1.Fname Fname, T2.Lname Lname
FROM table1 T1
JOIN table2 T2 ON T1.id = T2.id
select Fname from Table1 join Table2 on Table1.id = Table2.id where id = 1
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.