0

I have mutliple tables with same name with added date in the last as abc_2016_09.

Now How can i call this mentioned statement, pls help.

SET @var = concat('ABC_table','_',date_format(curdate(), '%Y'),'_',date_format(curdate(), '%m'));

AND THEN

select * from @var

error code 1069 is coming.

0

1 Answer 1

0
SET @var = concat('abc_table','_',date_format(curdate(), '%Y_%m'));

SET @statment = concat('select * from ', @var);

PREPARE stmt FROM @statment; 
EXECUTE stmt;

Check it in mysql workbench, It does not return row in mariadb.

Sign up to request clarification or add additional context in comments.

2 Comments

date_format(curdate(), '%Y_%m') is much simpler.
Yes sure...I have edited.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.