SQL-SELECT-Urgent help

murthyspd

Registered User.
Local time
Today, 18:52
Joined
Aug 3, 2006
Messages
31
Hi

A table in Access has fields orderNo, bill_to and ship_to in the order. OrderNo is a string and other two fields are Boolean(yes/no). While entering an order, an employee may make mistakes in Bill_to/ship_to or both. His manager, when reviewing, will uncheck the bill_to/Ship_to fields.

When I take a count while running a query, the OrderNo should be repeated twice giving me a count of 2 errors if the OrderNo has error in both. I needed help in framing a query.

Select OrderNo from tblOrdersAudit where Bill_to=false or ship_to=false

does not give the required result because it ignores ship_to=false if it catches bill_to=false.

If I want the above result, do I need to change the structure of the table. Please help.
 
Try:

Select OrderNo from tblOrdersAudit where Bill_to=false AND ship_to=false
 
Hi
Thanks for the reply. I tried that SQL. It gives OrderNo once, whereas I want the SQL to return OrderNo twice. One for Bill_to = false and second for ship_to = false, ie. if I take count, it should be 2 and not 1.
 
Murthy,

Union query.

Select OrderNo
From tblOrdersAudit
Where Bill_to = False Union
Select OrderNo
From tblOrdersAudit
Where ship_to = False

Wayne
 

Users who are viewing this thread

Back
Top Bottom