0

hello guys...i have a class table in which there are two fields class_id and class_name and a student form in which there is a text field in which user will mention the student class and then hit add.this will retrieve class_id from class table instead of class name into student table.i want to retrieve the id of specfic field from one table and put it in the other table...is this possible with mysql queries to retrieve specfic id of the field from one table and input it into anonther table.if so please let me known.hope you understand my explaintion of my problem

2
Contributors
5
Replies
6
Views
6 Years
Discussion Span
Last Post by extemer
0

like

INSERT INTO FIELD_NAME FROM TABLE_NAME SELECT FIELD_ID FROM TABLE_NAME WHERE...

where part before select will be one table and part after select will be another table.are you getting my point

Edited by extemer: n/a

0

Yeah, I think that's what my example does.

I may have left off an "into". Student and Class are tables in this example.

INSERT into student(classId)
    SELECT classId FROM class WHERE...
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.