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

Syntax for minimum amount

In Mysql how can I request the smallest number in a table field of numbers? Also what would be the syntax for deleting that number after it is pulled?
0
roduno
Asked:
roduno
1 Solution
 
UmeshMySQL Principle Technical Support EngineerCommented:
Hi,

Yes u can get the smallest number using MIN() & using user variables you can delete after pulling that small number..

Say u have atble named umesh & has two fields (name,money)..and you want to pull MIN of money & also wants to delete that records..

This would pull the MIN of money..

SELECT @money:=MIN(money) FROM umesh;

This woyuld delete that row..

DELETE FROM umesh WHERE money=@money;
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

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