Mysql
 sql >> Database >  >> RDS >> Mysql

Ordina per alias in mysql contenuto in if query

usa questa query le sue opere usano round(prezzo)

   SELECT 
       *, 
         IF( SUBSTRING( price , '1', '1' ) = '$', 
              round( replace( price , '$', '' ) ) ,
              round(price) ) AS coupon 
          FROM ccs_product 
         WHERE (product_name LIKE '%JoyLot.com%' 
     OR website_name LIKE '%JoyLot.com%' 
     OR description LIKE '%JoyLot.com%')
        ORDER BY coupon ASC 
   LIMIT 0 , 10;