Reputation: 319
This code doesn't work in Oracle
SELECT cost
FROM
(
SELECT shoppingserviceid,cost,bsid
FROM service JOIN shopping_service
ON service.serviceid = shopping_service.serviceid
) as S
WHERE cost = 2000
But this code below works
SELECT cost
FROM
(
SELECT shoppingserviceid,cost,bsid
FROM service JOIN shopping_service
ON service.serviceid = shopping_service.serviceid
)
WHERE cost = 2000
Well, I am new in oracle and before I am used to code in MySQL. How can I use AS
statement in oracle?
Upvotes: 2
Views: 191
Reputation: 311508
Table aliases in Oracle don't use the AS
keyword:
SELECT cost -- can also use S.cost
FROM
(
SELECT shoppingserviceid,cost,bsid
FROM service JOIN shopping_service
ON service.serviceid = shopping_service.serviceid
) S
WHERE cost = 2000 -- Can also use S.cost
Upvotes: 7