> For the complete documentation index, see [llms.txt](https://kythuat.dtechvn.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kythuat.dtechvn.com/danh-muc/xoa-b-dong-khong-phat-sinh.md).

# XÓA BỎ DÒNG KHÔNG PHÁT SINH

## YÊU CẦU

* Nếu danh mục không phát sinh thì xóa bỏ

## HƯỚNG DẪN

* Code mặc định 1 danh mục muốn xử lý

<pre class="language-sql"><code class="lang-sql">-- chạy select  kiểm tra
-- okie thì comment select, mở delete
select  t1.ma,t1.ten,t1.VuViec as id_danhmuc, t2.vuviec
<strong>-- delete T1
</strong>from
(select * from vuviec where vuviec&#x3C;>0 and cap=0)T1 left join
(
	select vuviec 
	from dulieuketoan 
	where vuviec&#x3C;>0
	group by vuviec 
)T2 on t1.VuViec = t2.VuViec
where t2.VuViec is null
</code></pre>
