June 19, 2008 at 9:48 pm
Ok peeps maybe someone can help me out here!! the below QUERY basically is a straight select with 1 real condition
which is Transaction_Type LIKE 'Down Time%'
but what i need is a query that says if i do have a
Transaction_Type LIKE 'Down Time%' which is select below run as normal but if i DONT HAVE A Transaction_Type LIKE 'Down Time%' i'll hard code the select??? Make sense
Bottom Line i need with Transaction_Type LIKE 'Down Time%' and Transaction_Type NOT LIKE 'Down Time%' all in one select statement somekind of way
example
Joe Smith 2.00 120 = WITH Transaction_Type LIKE 'Down Time%
Jane smith 0.00 0.00 = WITH OUT Transaction_Type LIKE 'Down Time%
SELECT TblMasterTrans.User_ID, Time_Spent, Downtime
FROM TblMasterTrans,TblContractInfo_SubMenuTable
WHERE Date_Opened Between '06-01-08' And '06-07-08'
AND TblMasterTrans.Task_Number = TblContractInfo_SubMenuTable.Task_Number
AND TblMasterTrans.User_ID = TblContractInfo_SubMenuTable.User_ID
AND Transaction_Type LIKE 'Down Time%'
GROUP BY TblMasterTrans.User_ID
June 20, 2008 at 12:30 am
Please don't cross post. It just wastes people's time and fragments replies. Many of us read all the forums.
No replies to this thread please. Direct replies to:
http://www.sqlservercentral.com/Forums/Topic520315-338-1.aspx
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply