query problem

  • Thread starter peljo via AccessMonster.com
  • Start date
P

peljo via AccessMonster.com

I want to make a query with two conditions : to include all the orders having
orders.Audit = > True and also all the orders where orders.Suborder = true.
I want to exclude the orders that have no criteria as Audit = True or
Suborder = True.
I cannot do it, since in the query I have built there are also orders which
have neither Audit = True or Suborder = True
How can I exclude those last order from the query? I did try to add in the
where clause orders.suborder = True but the query does not give the right
results

SELECT orders.orderid, orders.audit, orders.SubOrder
FROM orders INNER JOIN [order details] ON orders.orderid = [order details].
OrderID
GROUP BY orders.orderid, orders.audit, orders.SubOrder
HAVING (((orders.orderid)>=(SELECT Max(orders.orderid) FROM orders WHERE
orders.Audit =True)));

In our database we begin calculating from the orderid that has Audit = true.
There is only one order with Audit = True, but after this order there are
many orders that have Suborder = True and a lot of orders that have no
restrictions.My first task is to calclate the quantities from all the orders
where Audit => true or Suborder = true. I will be very grateful for any help
in this difficult assignment.
I can send an example if needed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Brain cramp - pull counts of orders closed 1
Unable to append due to key violations 2
union query 0
cross tab query help 3
Delete query 1
Calculate Null in query question 0
Ecount help please 3
Query Speed/Indexes 6

Top