A
A
Almik Oh! Give me a guitar2014-11-20 12:36:37
Oracle
Almik Oh! Give me a guitar, 2014-11-20 12:36:37

Oracle: why is there an error?

Hello,
in general, there is such a request:

SELECT S.cost
    FROM(
            (
                SELECT shoppingserviceid ,cost,bsid
                FROM service JOIN shopping_service 
                ON service.serviceid = shopping_service.serviceid 
            ) S JOIN provided_service
            ON provided_service.shoppingserviceid = S.shoppingserviceid
        ) P JOIN provide_service_detail
        ON  provide_service_detail.providedserviceid = P.providedserviceid

which returns the error
CDbCommand failed to execute the SQL statement: ORA-00933: SQL command not properly ended. The SQL statement executed was:
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vladimir, 2014-11-20
@azrail_dev

It’s hard to understand something here, use named queries, everything will fall into place.
WITH query_name AS (subquery)

A
Almik Oh! Give me a guitar, 2014-11-20
@almyk

I did it like this and it works:

SELECT *
    FROM service 
      JOIN shopping_service 
        ON service.serviceid = shopping_service.serviceid
      JOIN provided_service
        ON provided_service.shoppingserviceid = shopping_service.shoppingserviceid
      JOIN provide_service_detail
        ON provide_service_detail.providedserviceid = provided_service.providedserviceid

G
Geny, 2014-11-20
@Geny

1. S.cost - not visible at the top level
2. The condition provide_service_detail.providedserviceid = P.providedserviceid will not work
3. You need to rewrite something like this

SELECT S.cost
  FROM (select * from ((SELECT shoppingserviceid, cost, bsid FROM service JOIN shopping_service ON service.serviceid = shopping_service.serviceid) S JOIN
         provided_service ON provided_service.shoppingserviceid = S.shoppingserviceid)) P
  JOIN provide_service_detail
    ON provide_service_detail.providedserviceid = P.providedserviceid

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question