Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Subquery SQL exec return null

Init table:

CREATE TABLE "PUBLIC".testtable 
( 
    id   INTEGER primary key, 
    name VARCHAR 
)

INSERT INTO testtable VALUES (1, 'test');
INSERT INTO testtable VALUES (2, 'test2');

Query produces an error?

SELECT * 
FROM
    (SELECT id, name 
     FROM
         (SELECT id, name 
          FROM testtable)
    )

Running this query returns this error:

[Code: 1, SQL State: 50000]
class org.apache.ignite.IgniteCheckedException: null

enter image description here

exec normal,such as :

 select * from (
     select id,name from 
     (select id,name from testtable
     )
     )

select * from (
     select * from 
     (select id,name from testtable
     )  parent where id>1
     )

select * from (
     select id,name from 
     (select id,name from testtable
     )  parent where id>1
     )
like image 344
ask Avatar asked Dec 10 '25 11:12

ask


1 Answers

You can using alias

select * from ( select id,name from ( select id,name from testtable ) as t )as b

like image 146
asghar amini Avatar answered Dec 13 '25 01:12

asghar amini



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!