Link to home
Start Free TrialLog in
Avatar of thenone
thenone

asked on

sql statement

mysql 5.0


correct sql statemnt to change a column from yes to no
SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of thenone
thenone

ASKER

thanks angel
Avatar of thenone

ASKER

and if I do not have a primary key?
>and if I do not have a primary key?
how do you identify the row to update then?
UPDATE `yourtable` SET `thecolumn` = 'no' WHERE `thecolumn` = 'yes'

This will update everything - regardless of the id
Avatar of thenone

ASKER

and if I was doing it with a recordset?
Avatar of thenone

ASKER

ok so if I have a recordset where it is rs.open"select * from table1 where column=no"

then when I am looping through my records how can I have the recordset be able to change that column one at a time from no to yes.
rs.open "select * from table1 where column=no"
while not rs.eof
   rs.fields("column").value = "yes"
   rs.update
   rs.movenext
wend
rs.close
Avatar of thenone

ASKER

so just this?

rs.fields("column").value = "yes"

ok thanks.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial