0

I created a view and could successfully execute the query:

Here is the output.

customer_ID Item_number Frequency
1            53           10
1             64           10
2             82           11
2              64          11
2              11           9

I need to return only the highest frequency rows ie.

customer_ID   Item_number Frequency
1              53          10
1              64          10
2              82          11
2              64          11

Help in this regard is highly appreciated.

Strawberry
  • 33,750
  • 13
  • 40
  • 57

1 Answers1

0

You can select the highest frequency for each customer and make an inline table and join with the main table, that will solve your problem.

For example:

select a.* from your_tab_1 a
join (select customer_id,max(frequency) as frequency from your_tab_1 group by customer_id) b
on a.customer_id = b.customer_id and a.frequency = b.frequency;
Vivek
  • 783
  • 5
  • 11