用序列号列出mysql中的所有表
我想用序列号列出数据库中的所有表,类似这样用序列号列出mysql中的所有表,mysql,sql,Mysql,Sql,我想用序列号列出数据库中的所有表,类似这样 +-------+---------------------------------------+ | sl_no | table_name | +-------+---------------------------------------+ | 0 | aaaaccadminprofile | | 0 | aaaaccbadloginstat
+-------+---------------------------------------+
| sl_no | table_name |
+-------+---------------------------------------+
| 0 | aaaaccadminprofile |
| 0 | aaaaccbadloginstatus |
| 0 | aaaacchttpsession |
| 0 | aaaaccoldpassword |
| 0 | aaaaccount |
| 0 | aaaaccountowner |
| 0 | aaaaccountstatus |
| 0 | aaaaccownerprofile |
| 0 | aaaaccpassword |
| 0 | aaaaccsession |
| 0 | aaaaccsessionaudit |
| 0 | aaaaccsessionprop |
| 0 | aaaaccuserprofile |
我试过这个密码
select @a:=0 as sl_no, table_name from information_schema.tables where table_schema = 'eventlog';
但我不知道在哪里增加值,它只显示0。添加(@a:=@a+1)显示错误。
有人能帮帮我吗。你可以试试下面的-
set @a=0;
select (@a:=@a + 1) as sl_no, table_name
from information_schema.tables
where table_schema = 'eventlog';
您使用了
,
:(@MatBailie,谢谢您,先生-修改了答案