Help Delete Query

GaDauBac

Member
Local time
Today, 10:58
Joined
Mar 22, 2021
Messages
42
I have 1 database (attachment)
- I can't run Delete query to manually delete specified fields
Please everyone help me. Thank you very much!
 

Attachments

there is no attachment
 
check and test.
 

Attachments

Attachments

  • Capture1.JPG
    Capture1.JPG
    32.4 KB · Views: 222
The schema is incorrect. It violates second normal form. MaKH does not belong in tb2_ChiTietHopDong. You would obtain the MaKH value by joining to tbl2_ThongTinHopDong.

You didn't explain what exactly your problem was but when you have two related tables in a query and you try to delete a row (you CANNOT delete a column, you only delete rows), it is the "child" table that you delete from NOT the parent table. If you want to delete a row from a parent table based on a value in the child table, you MUST have cascade delete specified since you obviously cannot delete a parent that has child record without it AND you need to use a sub query to identify the row since you can only delete child rows from a query with a join.
Thank you! I edited it again, but when I delete the record in tbl2_ThongTinHopDong, I still get an error. I'm still studying with you.
 

Attachments

  • Capture.JPG
    Capture.JPG
    25.6 KB · Views: 240

Users who are viewing this thread

Back
Top Bottom