> 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/kiem-tra-tai-khoan-co-loi-tren-dulieuketoan.md).

# KIỂM TRA TÀI KHOẢN CÓ LỖI TRÊN DULIEUKETOAN

## 1. Kiểm tra

* Tài khoản không tồn tại
* Tài khoản hạch toán vào cấp mẹ

```sql
// Some code
select  t1.tkno,t2.ma, t2.ten
from 
(select tkno from vr group by tkno)T1
full outer join
(select * from taikhoan) t2 
on t1.tkno = t2.ma
where 
t2.ma is null  -- tài khoản không tồn tại trên danh mục tài khoản
or (t2.Cap=1 and t2.ma = t1.TKNO) -- tài khoản hạch toán vào mã mẹ
--or t1.TKNO is null
order by t1.tkno
```
