[英]convert uuid from bin in select * statment
I've got an id column in my mysql table which contain a uuid in a binary(16) form , if i will select only this specific column like this: 我在mysql表中有一个id列,其中包含一个binary(16)形式的uuid,如果我将仅选择此特定列,如下所示:
SELECT uuid_from_bin(id) FROM table_name;
i will get the uuid properly but as soon as i try to select * like this: select * from table_name;
我会正确地获取uuid,但是一旦我尝试选择*就是这样: select * from table_name;
i'm getting the uuid in binary form. 我正在以二进制形式获取uuid。
i tried something like this: 我尝试过这样的事情:
SELECT uuid_from_bin(id),* FROM table_name;
but this gives me an error 但这给我一个错误
SELECT *, uuid_from_bin(id) as uuid FROM table_name;
try to use alias for your table. 尝试为您的表使用别名。 in my example the alias is t
在我的示例中,别名为t
SELECT uuid_from_bin(t.id), t.* FROM table_name t;
if you need only specific columns, so do not use *
in your select
. 如果只需要特定的列,则不要在select
使用*
。 use only columns you need eg 仅使用您需要的列,例如
SELECT uuid_from_bin(t.id), t.col1, t.col2 ...
FROM table_name t;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.