Nested SELECT clause in SQL Compact 3.5

In this post, “ select with nested selection, ” I read that SQL Compact 3.5 (SP1) supports a nested SELECT clause. But my request does not work:

t1 - table 1 t2 - table 2 c1, c2 = columns

select 
 t1.c1, 
 t1.c2, 
 (select count(t2.c1) from t2 where t2.id = t1.id) as count_t 
from 
 t1 

Does SQL Compact 3.5 SP1 support a nested SELECT clause in this case?

Update:

SQL Compact 3.5 SP1 works with this type of subquery:

  • SELECT ... from ... where .. IN (SELECT ...)
  • SELECT ... from (SELECT ...)
+3
source share
4 answers

Thank you all for your help and advise.

- . SQL Compact 3.5 SP1 select.

+8

, , , .

Try

select * from LogMagazines where id IN (select max(id) from UserRoles)

, , , , , , , :

SELECT 
    t1.c1,  
    t1.c2,  
    count_t.c
FROM 
    t1 JOIN (select id, count(t2.c1) as c from t2 GROUP BY t2.id) count_t 
       ON t1.id = count_t.id

+6

select max(Id) from UserRoles , . select * from LogMagazines where id = , -.

+1

,

select * from LogMagazines where id = (select max id from UserRoles)

?

0

Source: https://habr.com/ru/post/1726265/


All Articles