简体   繁体   中英

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:

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; i'm getting the uuid in binary form.

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

SELECT uuid_from_bin(t.id), t.* FROM table_name t;

if you need only specific columns, so do not use * in your select . use only columns you need eg

SELECT uuid_from_bin(t.id), t.col1, t.col2 ...
  FROM table_name t;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM