You can use analytical functions like [ROW_NUMBER()](https://community.denodo.com/docs/html/browse/latest/vdp/vql/appendix/syntax_of_condition_functions/analytic_functions_window_functions#row-number) to achieve this. If the underlying data source supports such analytical functions then Virtual DataPort will delegate these functions to the data source. If the underlying data source does not support such functions take a look at [DataMovement optimization](https://community.denodo.com/docs/html/browse/latest/vdp/vql/appendix/syntax_of_condition_functions/analytic_functions_window_functions#workaround-to-execute-analytic-functions) to see if the workaround is possible.
If a customer can have a maximum of 2 records with different driver values then the below query can be used. Assume the view has 2 integer columns – customer & driver.
select b.customer,b.driver from bv_customer_driver b join (
select customer,max(driver) driver from bv_customer_driver group by customer) a
on b.customer = a.customer and b.driver = a.driver;
You can also use the query above to create a derived view. Have a look at [Defining a Derived View](https://community.denodo.com/docs/html/browse/latest/vdp/vql/defining_a_derived_view/defining_a_derived_view) Virtual DataPort guide for more details.
Hope this helps!