简体   繁体   中英

MYSQL select same column name as alias as Number not working

I have create query something like bellow :

SELECT col_1 as "0", Col_2 as "1" FROM table

It is working when run in phpmyadmin but not work when run through php. But when change as "zero" as "one" its working fine.

Any solution or suggestion.

I am using wordpress

$results = $wpdb->get_results( 
                'SELECT t.id,qrnumber ,
                tu.display_name,if(t.status=0,"---","Used") as "3" 
                FROM '.$table.' t 
                LEFT JOIN '.$table_wp.' tu ON tu.ID=t.user_id', ARRAY_A 
            );

Thanks

您缺少逗号

SELECT col_1 as "0", Col_2 as "1" FROM table

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