SQL novice here.
I’m trying to get a list of invoice numbers. There are two tables – invoices and invoicedetail. The invoicedetail table has a field called scanned (it’s a bit field). If it’s been scanned, then the bit field is 1.
For each invoice, there are associated records in the invoicedetail, but I only want a list of the invoice numbers where every associated record in invoicedetail’s scanned field is 1.
I’d rather do this in a single query if possible.
The records scanned in InvoiceDetail is all records – for any invoice number returned.
Your help is appreciated.
Or…
Just make sure you change the column names to fit your needs. Use your ID from each table for the joins and then use a
WHEREto filter the records to just show those which are scanned. Being that you are using a bit field you will simply useWHERE ScannedColumn = 1.