Kewin Björk Nielsen Kewin Björk Nielsen - 1 year ago 60
SQL Question

how to check if a value is 1 and then change it to 0

how do i check if a value is

in my column(that is called trashed numeric(18, 6)that are in fileitem table) then i update and if it is
then i wan't to change it to

my statement for updateing is

String query ="Update PS set ShelfNumber =' "+text2+ " ' from [file].[ItemPart] PS "+ " join [file].[Item] P on = "+ " where P.ItemNumber = '"+text1 + "'";
PreparedStatement preparedStatement = con.prepareStatement(query);

not sure if i have to make it as a stored procedure for being able to do it

Answer Source

I would expect an update to look something like this:

update t
    set trashed = 0
    where trashed = 1;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download