I have the following table:
id group item qty
1 fruits banana 2
2 fruits orange 3
3 fruits grape 5
4 b+c bread 10
5 b+c noodles 12
6 meat eggs 7
The following SQL statement:
SELECT food_list.group, Count(food_list.item) AS nb_items, Avg(food_list.qty) AS avg_qty
FROM food_list GROUP BY food_list.group;
returns:
group nb_items avg_qty
b+c 2 11
fruits 3 3,333333333
meat 1 7
How can I add row numbering in my output table, using the SELECT statement, since this is an aggregate function?
id group item qty
1 fruits banana 2
2 fruits orange 3
3 fruits grape 5
4 b+c bread 10
5 b+c noodles 12
6 meat eggs 7
The following SQL statement:
SELECT food_list.group, Count(food_list.item) AS nb_items, Avg(food_list.qty) AS avg_qty
FROM food_list GROUP BY food_list.group;
returns:
group nb_items avg_qty
b+c 2 11
fruits 3 3,333333333
meat 1 7
How can I add row numbering in my output table, using the SELECT statement, since this is an aggregate function?