I’m trying to combine two queries into one if it’s possible, here is what I would like to do.
- SELECT everything (*) from the Table Called FDetail
- WHERE the TransactionDate is between 01/01/2007 and 01/01/2015
- AND WHERE ComNum=1090084785010
- AND get the entire record where RecID (RecID is the name of the column)= 32375 and also RecID=11174 <– EVEN IF IT’S NOT THE ComNum that is specified above but does have to fall in between the dates specified
- AND skip the record where RecID=24425
I trield something like this but this is wrong:
SELECT * FROM FDetail
WHERE TransactionDate >= #01/01/2007#
AND TransactionDate <= #01/01/2015#
AND ComNum=1090084785010
AND RecID=32375
AND RecID=11174
AND NOT RecID=24425
ORDER BY ASC
here is now I would do it from two queries?
Query 1:
SELECT * FROM FDetail
WHERE ComNum=1090084785010
AND TransactionDate >= #01/01/2007#
AND TransactionDate <= #01/01/2015#
ORDER BY ASC
Query 2:
SELECT * FROM FDetail
WHERE TransactionDate >= #01/01/2007#
AND TransactionDate <= #01/01/2015#
AND RecID=32375
AND RecID=11174
AND NOT RecID=24425
ORDER BY ASC
This is for a MS Access Database but I would like to know how to do it in MS SQL also, (unless the only diffrence is the # for the dates)
As always, Thank you so much for any help that you provide me. I’m so greatful for this community and all of you great people trying to help others.
Hope it helps, rgds.