Hello all,
I'am trying to figure out how to execute a MySQL statement that will Update WHERE min(item) and Available='yes' ... any suggestions?
Item is a column and and Available is a column too.
I want to update this particular row at the minimum item number and where Available is no.
MySQL Update statement:
- hallsofvallhalla
- Site Admin
- Posts: 12026
- Joined: Wed Apr 22, 2009 11:29 pm
Re: MySQL Update statement:
I may not be reading the post right but whats wrong with
And if that doesnt work then
Code: Select all
SELECT MIN(Item) FROM table_name where Available = 'no';
Code: Select all
SELECT Item FROM table_name where Available = 'no' ORDER BY Item ASC LIMIT 1;
Re: MySQL Update statement:
The SELECT function i wrote works it is:
SELECT min(items) FROM `bogogame`.`itembox` WHERE Available='Yes'
And this works, it displays the minimum item that is available, but i want to UPDATE where the min(item) is Available.
SELECT min(items) FROM `bogogame`.`itembox` WHERE Available='Yes'
And this works, it displays the minimum item that is available, but i want to UPDATE where the min(item) is Available.
Re: MySQL Update statement:
I guess what im trying to say is that I want to UPDATE my table (itembox) WHERE the min(item)= *(whatever the lowest item is)* and WHERE Available = Yes
- hallsofvallhalla
- Site Admin
- Posts: 12026
- Joined: Wed Apr 22, 2009 11:29 pm
Re: MySQL Update statement:
ahhhh
something like
Should work
something like
Code: Select all
update `bogogame`.`itembox` SET Item='Whatever' Where item=(select min(item) from `bogogame`.`itembox`) AND Available = 'Yes')