A question about complex SQL statement
- by william
Table A has columns ID and AName, Table B has columns BName and ID.
B.ID is foreign key of A.ID.
Write a SQL statement to show data like:
print column AName and C which describe whether Table B has ID in Table A, if exists 1 or else 0.
So if A is:
1 aaa
2 bbb
B is:
something,2
output is:
aaa,0
bbb,1