hi guys! i have a problem regarding the queries i coded. my first query is to display the category name, description and maxscore:

SELECT c.cat_name, g.maxscore, g.description
FROM grp_performance
INNER JOIN category c
ON g.cat_id = c.cat_id

the problem is, i don't know how to delete the row in the gp_performance table without deleting the records in the category table. i tried using innerjoin but still it doesn't work. this is part of our thesis project and i really need some help! :(

Recommended Answers

All 4 Replies

This is the model. Adapt to your tables.

delete from grp_performance
where g.id in 
(
SELECT g.id
FROM grp_performance
INNER JOIN category c
ON g.cat_id = c.cat_id
)
commented: agree +13

g.id? you mean the primary key of grp_performance?

DELETE from grp_performance(TABLE NAME) WHERE g.id IN(PRIMARY KEY);
Try this.

commented: if do not know the answer, do not post crap here. -3
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.