I haven' been using SQL to long and I'm trying to create a query.
The syntax works in MS Access but when brought into oracle(Toad) I get a message at the ". AS" ORA-00905: missing keyword. I replaced the [ ]'s with ( ) after the INNER JOIN statement because it didn't line the joined table name when I used them.
SELECT APPS.CST_ITEM_C OST_TYPE_V.Item _number, APPS.CST_ITEM_C OST_TYPE_V.Desc ription, APPS.CST_ITEM_C OST_TYPE_V.Cost _Type, APPS.CST_ITEM_C OST_TYPE_V.Item _Cost
FROM APPS.CST_ITEM_C OST_TYPE_V INNER JOIN (SELECT Item_Number, Max(Cost_Type) AS MaxCost_Type FROM APPS.CST_ITEM_C OST_TYPE_V GROUP BY Item_Number). AS q ON (APPS.CST_ITEM_ COST_TYPE_V.Cos t_Type = q.MaxCost_Type) AND (APPS.CST_ITEM_ COST_TYPE_V.Ite m_number = q.Item_Number)
Can anyone help out.
Thanks,
Scott
The syntax works in MS Access but when brought into oracle(Toad) I get a message at the ". AS" ORA-00905: missing keyword. I replaced the [ ]'s with ( ) after the INNER JOIN statement because it didn't line the joined table name when I used them.
SELECT APPS.CST_ITEM_C OST_TYPE_V.Item _number, APPS.CST_ITEM_C OST_TYPE_V.Desc ription, APPS.CST_ITEM_C OST_TYPE_V.Cost _Type, APPS.CST_ITEM_C OST_TYPE_V.Item _Cost
FROM APPS.CST_ITEM_C OST_TYPE_V INNER JOIN (SELECT Item_Number, Max(Cost_Type) AS MaxCost_Type FROM APPS.CST_ITEM_C OST_TYPE_V GROUP BY Item_Number). AS q ON (APPS.CST_ITEM_ COST_TYPE_V.Cos t_Type = q.MaxCost_Type) AND (APPS.CST_ITEM_ COST_TYPE_V.Ite m_number = q.Item_Number)
Can anyone help out.
Thanks,
Scott
Comment