Compare 2 dates, return those not alike

J

Jeremy Ward

I have a query where I'm pulling the following data:

Part_Num
Cust_Num
Order_Num
Enter_Date
Last_BO_Notify_Date

What I want to do is NOT return any records where the
Enter_Date and Last_BO_Notify_Date are the same date.

Any suggestions? Currently, the SQL view of the query
looks like this:

SELECT SM_PRODUCT.P_PROD_NUM AS Part_Num,
SM_ORDERS.O_CUST_NUM AS Cust_Num, SM_ORDER_OPEN.OO_ORD_NUM
AS Order_Num, SM_ORDER_OPEN.OO_ENT_DT AS Enter_Date,
SM_ORDER_OPEN.OO_LAST_BONOTIF_DT AS Last_BO_Notify_Date

FROM ((SM_ORDER_OPEN INNER JOIN SM_ORDER_OPEN_LN ON
SM_ORDER_OPEN.OO_ORD_NUM = SM_ORDER_OPEN_LN.OOL_ORD_NUM)
INNER JOIN SM_PRODUCT ON SM_ORDER_OPEN_LN.OOL_PROD_INT_NUM
= SM_PRODUCT.P_PROD_INT_NUM) INNER JOIN SM_ORDERS ON
SM_ORDER_OPEN.OO_ORD_NUM = SM_ORDERS.O_ORD_NUM

WHERE (((SM_ORDER_OPEN.OO_A_BO_F) Is Not Null) AND
((SM_PRODUCT.P_IQ_CAT2)="B"))

ORDER BY SM_ORDER_OPEN.OO_LAST_BONOTIF_DT;
 
B

Brian Camire

You might try adding the following to your WHERE clause

AND (SM_ORDER_OPEN.OO_ENT_DT <>
SM_ORDER_OPEN.OO_LAST_BONOTIF_DT)

This assumes that both fields are non-Null and do not contain time of day
components.
 

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

Top