changing a value in one field base on a vlaue in another field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In my table I hve a field named photoCount, which contains the total number
of photos related to this record, and one called Photo, which gives the name
of the first photo (this is based on oanother field).

I need the synatx for:

if the value in photoCount = 0 then
the name of the photo in Photo is 1.jpg

Thanks in adance
 
SELECT IIF(PhotoCount=0, "1.jpg", [Photo]) From Tablename

Another option to make it more permanant:

Update Tablename Set [Photo] = "1.jpg" WHERE PhotoCount = 0
 
Back
Top