Error to convert mssql to mysql

I created a procedure for counting a asked question using mssql. I am sending this request below. Now I want to convert the query below to mysql, but it returns an error. Please help me fix this error.

My partial request here ...

select trainPrecent1 = (select distinct(fldprecentage) from precentage where fldgroup='Training' and fldset='First'), trainPrecent2 = (select distinct(fldprecentage) from precentage where fldgroup='Training' and fldset='Second'), agentPrecent1 = (select distinct(fldprecentage) from precentage where fldgroup='Agent on floor' and fldset='First'), agentPrecent2 = (select distinct(fldprecentage) from precentage where fldgroup='Agent on floor' and fldset='Second'), superPrecent1 = (select distinct(fldprecentage) from precentage where fldgroup='Supervisor on floor' and fldset='First'), superPrecent2 = (select distinct(fldprecentage) from precentage where fldgroup='Supervisor on floor' and fldset='Second') 

Now I get the following error ...

  "unknown column name "trainPrecent1" in fielelist... 

Please help me fix this error ....

+4
source share
1 answer

TRy using AS instead of = :

 select (select distinct(fldprecentage) from precentage where fldgroup='Training' and fldset='First') AS trainPrecent1, ...... 
+4
source

Source: https://habr.com/ru/post/1412472/


All Articles