mercredi 23 décembre 2015

How to put two WHERE conditions in SQLite select statement?

My question is in a SELECT statement that fetch SQlite databse.

Assume I have the following Table1: ref_no, name, start_date

Assume also I have Table2: ref_no, payment

I want to select table2.ref_no, table2.payment, table1.start_date and table1.name where table2.payment is null and where table2.ref_no equal table1.ref_no sorted by table2.ref_no

I've tried this:

SELECT ref_no.Table1, name.Table2, tel.Table2
FROM Table1, Table2
WHERE payment.Table1 IS NULL OR
      payment.Table1 = ' 
ORDER BY ref_no.Table2
WHERE table1.ref_no = table2.ref_no

but no success ..

Aucun commentaire:

Enregistrer un commentaire