select {user_id} user_id , count_cards,count_desks,desks_import_open, cards_import_open
from
(select count(*) count_desks, ifnull(sum(import_open),0) desks_import_open
from
(SELECT * from desks where user_id = {user_id} and parent_desk = 0) desks1) desks_count,
(SELECT count(*) count_cards, ifnull(sum(import_open),0) cards_import_open from cards_data_base where user_id = {user_id}) cards_count

;
