dakasadaka Posted February 26, 2010 Share Posted February 26, 2010 I want to insert into same table value 1 where post_title begins like apartments I came with this : insert into post (post_categorie_id) values (1) SELECT post_id FROM post WHERE post_title LIKE '%Apartments' but doesn't work any help would be nice tnx, daka Link to comment https://forums.phpfreaks.com/topic/193444-insert-into-same-table-value-where-post_title-begins-like-apartments/ Share on other sites More sharing options...
trq Posted February 26, 2010 Share Posted February 26, 2010 You need to use an UPDATE statement if you want to update an existing record. Theres also no need for any SELECT subquery. UPDATE post SET post_categorie_id = 1 WHERE post_title LIKE '%Apartments'; Link to comment https://forums.phpfreaks.com/topic/193444-insert-into-same-table-value-where-post_title-begins-like-apartments/#findComment-1018416 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.