• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 317
  • Last Modified:

How to delete records from a table in pure SQL?

I have been playing around with the insert statement in my SQL, i looked at my table and noticed that i have got 8 records for one person and 8 records for another person both of whom i used the insert statement for numerous times, obviously i only want one record for each person.

I tried to use logic, and tried DELETE * FROM Person WHERE FirstName = 'Jack Lumsdon'

&

                                             DELETE * FROM Person WHERE FirstName IS =('Jack Lumsdon')

But to no avail. I get a red squiggly line underneath the * and the error message Incorrect syntax '*'.

Any ideas of how i can get my table to delete these and bring me back down to just one record for each person.

Thanks!
0
SuperJinx
Asked:
SuperJinx
1 Solution
 
mwochnickCommented:
try DELETE FROM Person WHERE FirstName = 'Jack Lumsdon'
0
 
SuperJinxAuthor Commented:
No joy! in the message's also says 0 records affected
0
 
RehanYousafCommented:
Can you show some sample records for table PERSON and also the schema

I think what you want is to compare firstname and lastname fields

DELETE FROM Person 
WHERE FirstName = 'Jack' and LastName = 'Lumsdon'

Open in new window

0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
virtuadeptCommented:
Your example has a first and a last name in the quotes.  Is the table splitting name up into two columns perhaps and you need to specifiy FirstName = 'Jack' AND LastName = 'Lumsdon' in your WHERE clause?
0
 
SuperJinxAuthor Commented:
Nice one dude, that sorted it out for me!
Cheers!
0
 
mwochnickCommented:
to display the table structure execute a describe statement on the person table

describe person
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now