newtomysql — 2010-05-18T03:21:37-04:00 — #1
I have table called tblTransaction. I have my query such as this
"SELECT * FROM tbltransaction WHERE productID=2715 AND (outletFromID=4 OR outletToID=4) ORDER BY transactionDate,transactionTime,transactionDetailsID". The problem now I want to know is that if outletFromID!=4 and (transactionType='ti'). So if it not from outletFromID=4 then I just want to look for transactionType='ti'. How can I do this? Thank you.
newtomysql — 2010-05-18T12:51:27-04:00 — #2
Thank you it works just addition I had to add was (outletFromID=4 and transactionType<>'ti').
guido2004 — 2010-05-18T06:48:33-04:00 — #3
WHERE productID = 2715
AND (outletFromID = 4 OR
(outletToID = 4 AND transactionType = 'ti')
newtomysql — 2010-05-18T06:37:22-04:00 — #4
Ok my current query gives me all the transaction which have either outletFromID=4 or outletToID=4. The extra thing I want is that if it is outletToID=4 then the transactionType must be only 'ti' and no others. I hope I am clearer now.
guido2004 — 2010-05-18T04:17:55-04:00 — #5
Please post your query inside the appropriate tags.
And I'm not sure if you want a new query with those two criteria, or if you want to add them to the existing query. I'll go for the first
WHERE outletFromID <> 4
AND transactionType = 'ti'