i had a table categories(cid int primekey,name varchar,description text,parent_id,created date,updated date)
i want a script for insertion like this
insert into categories(...) values(cid value,name value,..desc, parent_Id..);
can i write the statement as
insert into categories(....) values (1,'aaa','some text',select parent_id from categories where parent_id=id,date,date);
just i wana know how can i write a select statement in insert statement
so that i can the column value through select statement.
in above querry i have to pick the parent value from cid.
srpa01red
0
Newbie Poster
Recommended Answers
Jump to PostYou can try following, but I am not able to understand what is id in "parent_id=id".
insert into categories(....) values select 1,'aaa','some text', parent_id date,date from categories where parent_id=id;
Are you going to execute above query in php or mysql directly?
All 2 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.