Guys your help was greatly appreciated last time and I was wondering if I could call on the collective wisdom of the group again

I have been playing with SQL again but I am stuck.
First off I made this up and it worked
Code: Select all
SELECT
SFDC_Transactions.Operation,
SUM
(datediff
(minute,
(SFDC_Transactions.Start_Time+SFDC_Transactions.Start_Date),
(SFDC_Transactions.End_Time+SFDC_Transactions.End_Date)
)
)
FROM
"Emax-Live".dbo.SFDC_Transactions SFDC_Transactions
WHERE
(SFDC_Transactions.Work_Order='NP') AND
(SFDC_Transactions.Live=0) AND
(SFDC_Transactions.End_Date>=getdate()-7)
GROUP BY
SFDC_Transactions.Operation
(Dates and times are held seperatly and I need to join them together)
It produces a table like so
code - time (in mins)
10 - 500
20 - 500
30 - 500
40 - 500
I then wanted to relate the codes to something meaningfull and I had to jump through hoops (jump across some tables) to find this.
Code: Select all
SELECT
SFDC_Transactions.Operation,
WO_Op_List.'Op Description',
SUM
(
datediff
(
minute,
(SFDC_Transactions.Start_Time+SFDC_Transactions.Start_Date),
(SFDC_Transactions.End_Time+SFDC_Transactions.End_Date)
)
)
FROM
"Emax-Live".dbo.SFDC_Transactions SFDC_Transactions,
"Emax-Live".dbo.WO_Op_List WO_Op_List,
"Emax-Live".dbo.WO_Operations WO_Operations,
"Emax-Live".dbo.WORK_ORDERS WORK_ORDERS
WHERE
SFDC_Transactions_List.Operation = WO_Operations.Op_No AND
WO_Operations.WO_ID = WORK_ORDERS.WORK_ORDERS_ID AND
WO_Op_List.WORK_ORDERS_ID = WORK_ORDERS.WORK_ORDERS_ID AND
(
(SFDC_Transactions_List."Work Order"='np') AND
(WORK_ORDERS.WO_No='136012') AND
(SFDC_Transactions_List."End Date">=getdate()-7)
)
GROUP BY SFDC_Transactions.Operation
When I try to run It I initially get a syntax error before I get
The multi-part identifier "SFDC_transactions_list.operation" could not be bound.
The multi-part identifier "SFDC_transactions_list.Work Order" could not be bound.
The multi-part identifier "SFDC_transactions_list.End Date" could not be bound.
I expect it to be something stupid like a missing comma but I can't get it to work.
Any help would be greatly appreciated.