here is a structure :-/ So I need to select ID and Names from CfgListGroupParIzm for CfgIzmeritel using Type and where ForRun - False it's
SELECT A.ID_ListGroupParIzm, A.Name
FROM CfgListGroupParIzm A, CfgIzmeritel B
WHERE A.ID_TypeIzmerit = B.ID_TypeIzmerit
AND B.ID_Izmerit=@ID_Izmerit AND A.ForRun=0
AND ID and NamePoint(from CfgIzmerPoint)+Name from CfgListGroupParIzm from same CfgIzmeritel where ID_Izmerit from CfgIzmeritel =ID_Izmerit from CfgIzmerPoint and ForRun from CfgListGroupParIzm - True
so finally I need something like
SELECT A.ID_ListGroupParIzm, A.Name
FROM CfgListGroupParIzm A, CfgIzmeritel B
WHERE A.ID_TypeIzmerit = B.ID_TypeIzmerit
AND B.ID_Izmerit=@ID_Izmerit AND A.ForRun=0
UNION -- ??
SELECT A.ID_ListGroupParIzm, (C.Name + A.Name) AS Name
FROM CfgListGroupParIzm A, CfgIzmeritel B, CfgIzmerPoint C
WHERE A.ID_TypeIzmerit = B.ID_TypeIzmerit
AND B.ID_Izmerit=@ID_Izmerit AND A.ForRun=1
AND C.ID_Izmerit=@ID_Izmerit
I think I need use some other construction without Union because I make mostly the same in both selects :-/