- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
if @new_dg_sor_code is null and @dg_sor_code<>7
and
(
(
(select count(*) from tbl_dogovorlist WITH (nolock) where dl_dgcod=@dg_code and dl_svkey in (1,1158,1166) and dl_control=0)=
(select count(*) from tbl_dogovorlist WITH (nolock) where dl_dgcod=@dg_code and dl_svkey in (1,1158,1166))
)
and (
(select count(*) from tbl_dogovorlist WITH (nolock) where dl_dgcod=@dg_code and dl_svkey=3 and dl_control=0)=
(select count(*) from tbl_dogovorlist WITH (nolock) where dl_dgcod=@dg_code and dl_svkey=3)
)
and (
(select count(*) from tbl_dogovorlist WITH (nolock) where dl_dgcod=@dg_code and dl_svkey=5 and dl_control=0)=
(select count(*) from tbl_dogovorlist WITH (nolock) where dl_dgcod=@dg_code and dl_svkey=5)
)
)
Видимо зарплата этого парня зависит от количества запросов к tbl_dogovorlist.
А иначе зачем ему 6 запросов вместо одного?