MySQL select value from table where field in (x,y,z) cycled output -
i have query this:
select value table field_id in (52,54,58,59,60,61,62,55,53,132) , item_id = 16 order field (field_id,52,54,58,59,60,61,62,55,53,132); currently, output grouped field_id, values of field_id 52 spit out, values of field_id 54, etc.
is there way inherent mysql loop output 1 value each field_id output 'round beginning pass? trying within sql native query, rather using php.
i guess said currently, output grouped field_id, , confuse people here. because according query not grouped. ordered.
but need it. try group (that bring 1 value per field_id):
select field_id, max(`value`), avg(`value`) `table` field_id in (52,54,58,59,60,61,62,55,53,132) , item_id = 16 group field_id order field (field_id,52,54,58,59,60,61,62,55,53,132); and can use aggregate functions min, max, avg use 1 of values if multiple per field_id.
Comments
Post a Comment