Hi I have an order list created in views with 2 fields: order ID and order payment method. Each order can have multiple payment methods (every payment method gets own incremented id when attached to order).


order id1 with payment id1
order id2 with payment id2 and payment id3
order id3 with payment id4

This causes duplicate rows in second case.

Problem: How can I show only orders with the last payment method attached to them?

One solution would be to create one view with order id argument, showing only one row and sorted by payment id descending. Then using views field view module and create another view with order list without duplicates.

Question: is there a more simple solution without creating second view? Thank you.

  • Is this really a Drupal question? Seems more like a database schema design question. Am I missing something? Nov 29, 2016 at 23:01
  • this problem occurred when working in drupal + commerce module and views. So I guess it is drupal / views related. Moreover I am specifically asking about views solution, so how this can not be drupal related?
    – loparr
    Nov 29, 2016 at 23:26

1 Answer 1


I would use Views Distinct module to filter the duplicates out. The way this works is this:

  • you select the displayed view field,expand 'Views Distinct Settings' and select 'Filter Repeats'

So, for your particular case, if you want to show only the last payment method, order by payment method (ID ?) DESC, and on the order_id filter repeats. This way, only the last row for every order_id will show.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.