onedumbcoder Posted May 17, 2009 Share Posted May 17, 2009 is it possible to have a select inside of a insert that will return a numbeR? for example I have lets say a table called animal with the following data id type 1 cow 2 bird 3 fox 4 cow can i do something like this INSERT INTO barn(animal, count) VALUES('cow', (SELECT COUNT(id) FROM animal WHERE type='cow')) Quote Link to comment https://forums.phpfreaks.com/topic/158520-select-inside-an-insert-that-returns-a-number/ Share on other sites More sharing options...
kickstart Posted May 17, 2009 Share Posted May 17, 2009 Hi That works. All the best Keith Quote Link to comment https://forums.phpfreaks.com/topic/158520-select-inside-an-insert-that-returns-a-number/#findComment-836052 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.