Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple SQL Statement (Hopefully)

Status
Not open for further replies.

mans

Programmer
Mar 18, 2000
136
0
0
AU
Hello,

I am attempting to delete a record in a table that contains the minimum numerical value. If the table is called staff and one column contains names and the other the ages, if I wish to delete the youngest person, what statement can I use without creating an additional table.

Thank You
 
What database are you using?

Is your age field numerical - if it is you will only be abe to delete ALL records that have that age, unless you have another field that delineates one age from another
 
Depending on your database - try:

delete from staff where age = (select min (age) from staff)

or

delete from staff where age = (select minimum(age) from staff)

This will deleta ALL records with the minimum age
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top