в Tablegrid выводится информация по запросу:
select
CASE when bdog.shifr is NULL then Type.type_gk_dog||' "'||trim(BDog.nameGK)||'"'
else Type.type_gk_dog||' "'||trim(BDog.nameGK)||'"'||', шифр "' ||trim(bdog.shifr)|| '"' end,
GLIsp.nameGI,
GZak.ZakName,
GLIsp.nameGI,
case when strftime('%d.%m.%Y',bdog.date_gk) is null then 'ГК '||BDog.num_gk
else 'ГК '||BDog.num_gk || ' от ' || strftime('%d.%m.%Y',bdog.date_gk) || ' г. ' end,
BDog.osnovanie,
strftime('%d.%m.%Y',VedIsp.startstage),
strftime('%d.%m.%Y',vedisp.endstage),
vedisp.id_bdog,
Type.id,
BDog.id_Type,
BDog.id,
BDog.id_GLIsp,
BDog.id_GZak,
BDog.num_GK
from bdog, glisp, Gzak, vedisp, type
where BDog.id_Type=Type.id and vedisp.id_bdog=bdog.id and GZak.id=BDog.id_GZak and (GZak.id={combobox2} or {combobox2}=-1)
and GLisp.id=bdog.id_Glisp and ({combobox1}=-1 or GLIsp.nameGI='{edit1}')
and (strftime('%Y',{DateTimePicker1})= strftime('%Y',vedisp.endstage) or strftime('%Y',{DateTimePicker1})= strftime('%Y',VedIsp.startstage))
group by BDog.num_GK
UNION ALL
select
CASE when SoispDog.shifr_dog is NULL then Type.type_gk_dog||' "'||trim(SoispDog.name_dog)||'"'
else Type.type_gk_dog||' "'||trim(SoispDog.name_dog)||'"'||', шифр "' ||trim(SoispDog.shifr_dog)||'"' end,
Soisp.nameIsp,
GZak.ZakName,
GLIsp.nameGI,
case when strftime('%d.%m.%Y',bdog.date_gk) is null then 'ГК '||BDog.num_gk
else 'ГК '||BDog.num_gk || ' от ' || strftime('%d.%m.%Y',bdog.date_gk) || ' г. ' end,
SoispDog.osn_dog,
strftime('%d.%m.%Y',VedIsp.startstage),
strftime('%d.%m.%Y',vedisp.endstage),
VedIsp.id_SoispDog,
Type.id,
SoispDog.id_Type,
SoispDog.id,
SoispDog.id_GLIsp,
SoispDog.id_BDog,
SoispDog.num_dog
from soispDog, bdog, glisp, soisp, Gzak, vedisp, type
where SoispDog.id_Type=Type.id and vedisp.id_soispdog=soispdog.id and GZak.id=BDog.id_GZak and (GZak.id={combobox2} or {combobox2}=-1)
and SoispDog.id_BDog=BDog.id and GLisp.id=SoispDog.id_GLIsp
and Soisp.id=SoispDog.id_Soisp and (soisp.id={combobox1} or {combobox1}=-1)
and (strftime('%Y',{DateTimePicker1})= strftime('%Y',vedisp.endstage) or strftime('%Y',{DateTimePicker1})= strftime('%Y',VedIsp.startstage))
and soisp.skontr=1
group by SoispDog.num_dog
order by Soisp.nameIsp
Такой же запрос хочу сделать Отчет (SQL). Подскажите правильно ли я делаю и как в Репорте сделать отчет?