mysql - MariaDB: Can I retrive duplicate column names without using 'AS' -


i have lot of tables use id primary key. when join several tables , select *, 1 of id columns displayed. when using mysql, way around use select as, example select id groupid.

is still case mariadb? duplicate column names not limited id field, end verbose select statements.

i hoping mariadb might introduce query feature allowed column names prefaced table names. example, query might bring columns names group.id , person.id.

edit: per comments shadow, problem not mariadb (or mysql matter). result set indeed include multiple 'id' fields. problem client library, in case pdo.

if have multiple columns in resultset same name, mysql returns of them, have same name in resultset well, unless use field alias. created sqlfiddle prove here. probably, client library cannot distinguish between 2 columns. known issue example laravel.

both mysql , mariadb allow prefix field names table names, but, table name not returned part of field name. however, client libraries able retrieve metadata columns in resultset returned mysql / mariadb, include table name non-calculated columns. see example mysqli_fetch_field_direct() function.

you can use table name retrieved metadata determine id column belongs table.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -