Databases
cancel
Showing results for 
Search instead for 
Did you mean: 

Using DERIVED TABLES with SELECT

prandip
Occasional Contributor

Using DERIVED TABLES with SELECT

I am having problems retrieving information using SELECT from derived tables. Here's an example of the code:

SELECT . FROM (select FROM )

e.g.
1) SELECT DISTINCT n.pk_node, RTRIM(n.corp_name) + '/' + RTRIM(n.name) AS 'name'
FROM
(
SELECT s.pk_node
FROM service s
JOIN requestor_to_service rs ON s.dts_resp_id = rs.dts_resp_id
JOIN node n ON n.pk_node = rs.pk_node
AND n.ext_node_info LIKE @ext_node_info + '%'
) t
JOIN node n ON t.pk_node = n.pk_node


2) select t.num from (select num=1) t

I get the error: Incorrect syntax near the keyword SELECT


Kindly advice. I am converting from SQL Server to Sybase. This wasn't an issue in SQL Server.
2 REPLIES
Yogeeraj_1
Honored Contributor

Re: Using DERIVED TABLES with SELECT

hi,

2.
"select num=1" does not seem to be correct hence the syntax error.

i guess it should be "select from "

what is the error for case 1?

revert

Yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
prandip
Occasional Contributor

Re: Using DERIVED TABLES with SELECT

Hi Yogeeraj,
Thanks but you didn't get my problem properly. The second SQL was just a simplified form of the use of derived tables for my cause. That doesn't exist for me in the real sense.
Anyway, that query is fine as per SQL Server syntax. I am facing problems using derived tables instead of actual tables after the 'FROM' clause. SQL Server allows that. Sybase is giving me a no-no.
Kindly advice.

Revert.

Prandip