rkevx21
rkevx21

Reputation: 3949

SQL: multiple execution

I need some help . I have this command in mysql

  SET SESSION group_concat_max_len = 200000

and

  SELECT CONCAT( 'DROP TABLE ', GROUP_CONCAT(table_name) , ';' ) 
    FROM information_schema.tables 
   WHERE table_schema = 'updates_temp' AND 
         table_name LIKE 'mg_%';" -s

how can I make it as one command .

Since I have error in

 mg_=`mysql -u$dbUser -p$dbPass -e "SET SESSION group_concat_max_len = 200000 SELECT CONCAT( 'DROP TABLE ', GROUP_CONCAT(table_name) , ';' ) FROM information_schema.tables WHERE table_schema = 'updates_temp' AND table_name LIKE 'mg_%';" -s`

Upvotes: 2

Views: 30

Answers (1)

ThomasVdBerge
ThomasVdBerge

Reputation: 8140

You should add a ;

mg_=`mysql -u$dbUser -p$dbPass -e "SET SESSION group_concat_max_len = 200000; SELECT CONCAT( 'DROP TABLE ', GROUP_CONCAT(table_name) , ';' ) FROM information_schema.tables WHERE table_schema = 'updates_temp' AND table_name LIKE 'mg_%';" -s`

Upvotes: 1

Related Questions