insert into image_gallery_headers
( business_id, gallery_category, gallery_header, sequence_number )
values( 477, 'main photo album', 'this', (select max(sequence_number)+1
from image_gallery_headers
where business_id = 477
and gallery_category = 'main photo album'
)
)
on duplicate key
update business_id = 477
, gallery_category = 'main photo album'
, gallery_header = 'this'
, sequence_number = (select max(igh.sequence_number)
from image_gallery_headers as igh
where business_id = 477
and gallery_category = 'main photo album')
Bookmarks