Срок регистрации домена PHPINCLUDE.RU закончился

Услуга по регистрации доменного имени PHPINCLUDE.RU временно не предоставляется.

По вопросам продления обратитесь к партнеру RU-CENTER

Если администратор домена не продлит регистрацию, домен освободится.


MYSQL - Code Snippets

insert into tablea select fields from tableb for specific values only

MYSQL No Comments »

While using insert into table select * from table there will be a problem that the total fields should match and the datatype should be same. But if there is table a and table b and you want to import table b’s few fields into table a then the above will not work and it will throw an error that total no of fields do not match.

So to import only specific fields then use the following sql in which only the needed fields are specified in the into part and the from part. so insert into table1 column names and select column names form table2.

INSERT INTO tablename (some_column, somecolumn2)
SELECT othercolumn1, othercolumn2 FROM TABLE name WHERE id=somevalue

the where clause is optional.

Notes to be taken http://stackoverflow.com/questions/1787634/automatically-match-columns-in-insert-into-select-from

Entries RSS