php - create table from existing table1 mysql -


is there way achieve below in mysql ?

  1. if table exists insert data table1 condition
  2. if table not exists create new table same schema , data given condition
  3. 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

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -