|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Beginner SQL question
this is not a Firebird specific question but i hope i can find answer here...
i have 2 tables, A and B...first contains let's say bills (Bill_ID) and the other contains the payments (also contains the Bill_ID field) please help me composing an SQL SELECT statement which will return ALL the bills (records) from A which has no payment yet (no occurence in table B) thanks in advance SZ |
|
#2
|
||||
|
||||
|
You need to LEFT OUTER JOIN the two tables ON A.BILL_ID = B.BILL_ID where B.BILL_ID IS NULL
You can find a link to tutorial about this in my signature.
__________________
My blog about OpenSource Databases PDF tutorials about OSS databases, DBMonster ... Please contribute to Open Source Development, fill bug reports!!! Developer Shed eSupport Commented my.ini/my.cnf (PLEASE ADD YOUR OWN CONFIG TRICK) An introduction to database normalization Natural or Surrogate key Custom ordering for your results Correlated and uncorrelated subqueries Don't turn your outer joins into inner joins |
![]() |
| Viewing: Dev Shed Forums > Databases > Firebird SQL Development > Beginner SQL question |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|