Delete Query

Steve56

Registered User.
Local time
Today, 12:37
Joined
Jan 26, 2004
Messages
12
Now I've never created a delete query can anyone help?

The problem is I don't know where to specify which table to delete the records.

If anyone could provide any help it would gbe very much appreciated.
 
Steve56 said:
The problem is I don't know where to specify which table to delete the records.

You do it in the Query Design View where you build any typ of query. To specifically create a Delete query, select Query -> Delete Query from the menu.
 
Sorry I wasn't being very specific. I've selected the delete query from the menu.

I've also added the fields/tables into the query. But when I try and run the query I get an error message stating the following:

"Could not delete from specified tables"

I don't know what I'm doing wrong as I've never tried to create one before.

I'm sorry for not being very specific.

Thanks anyway
 
Do you have Cascade Delete Records set up for any relationships you may have between these tables?
 
No sorry, I've tried to implement a many-to-many relationship. But I've had to create 2 link tables to be able to create this.

I'm wanting to create a delete query that will delete students details if they are not attending.

Basically I have the following tables

Student
Student-Activity (Link Table)
Activity
Grading (Link Table)
Result

Does that help make things a little bit more understandable?
 
Steve56 said:
I'm wanting to create a delete query that will delete students details if they are not attending.

The students attending details rather than the actual students?

If so then just delete from the line table.

i..e


DELETE *
FROM linkTable
WHERE StudentID = whatever the student's ID is And Activity = whatever the activity is;
 
Thank you. Thats worked.

I've never edited SQL before, so I really don't have a clue what to edit.

My teachers are no help ethier. They've produced a worksheet that has nothing to do with editing SQL.

Thanks for your help
 

Users who are viewing this thread

Back
Top Bottom