php - create table from existing table1 mysql -
is there way achieve below in mysql ?
- if table exists insert data table1 condition
- if table not exists create new table same schema , data given condition
- new table generated based on condition of php code.so need queries that.
i have tried below not working.i know there way in mysql achieve using queries.
create table schema.new_accounts if not exists ( select * schema.accounts) no data
below working me:
create table if not exists `new_accounts` `accounts`;
for data insert can run below sql condition:
insert `new_accounts` select * `accounts` column=1;
hope solves problem @ level
Comments
Post a Comment