delete from table where isDeleted = 1
select id from products as p
INNER JOIN productPropertys as type ON type.product_Id = p.id and type.value = 'ель'
INNER JOIN productPropertys as length ON length .product_Id = p.id and length .value = '200'
INNER JOIN productPropertys as someOtherProperty ON someOtherProperty .product_Id = p.id and someOtherProperty .value = '10'
WITH articlesCount(articleId,count) as
SELECT articleId, COUNT(tagId) as count from article_tags
GROUP BY articleId
SELECT what your need from article as a
INNER JOIN articlesCount as ac on a.id = ac.articleId
order by ac.count
insert into tab2 (id,numold)
select id, num from tab1
where id = @inputId
insert into tab1(id,num)
values @inputId,@inputNum
Так нельзя?В противном случае вам нужно определить условие where в первом запросе. Максимальный id или что-то подобное