SQL 想取一列数,然后除以取出来的第一个数怎么写?
select price/(select price from shop_flash_sale_commodity LIMIT 1) from shop_flash_sale_commodity
sql内一个值除以一些字段的和:
SELECT CONCAT(CAST(ROUND((#{age}/(SELECT sum( (case when t.stone1 is NULL then 0 ELSE t.stone1 END)+ (case when t.stone2 is NULL then 0 ELSE t.stone2 END) ) as aa from table t where id =#{id}))*100,3) AS CHAR),'%') as total_actual_weight from table WHERE id = #{id};