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 Quote 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'; Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.