There are several tables in the database, their names have the following format:

dialog_login1_login2 dialog_login1_login3 dialog_login2_login3 dialog_login3_login1 

I do not quite understand how I can create a sql query so that, as a result, it gives for example

 dialog_login1_login2 dialog_login1_login3 

That is, a sample of the phrase dialog_login1 _ *****

Or this result:

 dialog_login2_login3 

That is, a sample of the dialog_login2 _ *****

I hope clearly explained.

  • LIKE 'dialog_login1_%' or LIKE 'dialog_login2_%' not suitable? - Alexey Shimansky
  • In theory, yes, but I do not fully understand through select to make a request or how? - Nikola Krivosheya

1 answer 1

Should help

 SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE 'dialog_login1_%' 
  • 2
    show TABLEs LIKE 'dialog_1%' I found this answer for myself - Nikola Krivosheya