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')) 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 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
Archived
This topic is now archived and is closed to further replies.