Question Locked

How to collect desired data from two SQL tables?

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have two sql data tables
Table1 contains:
ACNO , NAME , CLASS
Table2 contains:
ACNO , NAME , FMONTH

ACNO => Acount Number
NAME => Student Name
FMONTH => Fee Month

I want to get the names of those students who didn't paid the fees for a particular month e.g. May

3 replies

by john.a.wills

for your specific problem, because there is no marker as to whether fees have been paid. However, the usual way to draw data from two tables at once is to join the tables...
SELECT *
FROM Table1 LEFT JOIN Table2 on Table1.ACNO = Table2.ACNO
You should be aware that there is probably a design mistake in your tables,as NAME appear in two tables and does not seem to be a key.

by oldbaritone

go back and review SELECT and JOIN statements

(SELECT x,y,z from (tbl.a JOIN tbl.b ON ...))

This discussion is closed to new replies.