mysql - Evaluating database() in a query -


how can use database() within query? here's example i'm trying do:

select database(); 

returns "my_table"

select * information_schema.statistics  table_schema = database() ,  table_name = 'my_table' , index_name = 'my_index' limit 1; 

doesn't work

select * information_schema.statistics  table_schema = (select database()) ,  table_name = 'my_table' , index_name = 'my_index' limit 1; 

doesn't work

select * information_schema.statistics  table_schema = 'my_table' ,  table_name = 'my_table' , index_name = 'my_index' limit 1; 

works charm

so question is, how can evaluate database() within query make query dynamic? need query check if index exists scripts knows if needs add or not.


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -