Hi,
To get the expected results as yours, I would follow the below steps,
1. In Source Configuration tab of JDBC data source, verify if the analytical function [COUNT](https://community.denodo.com/docs/html/browse/6.0/vdp/vql/appendix/syntax_of_condition_functions/analytic_functions_window_functions#count) is added to the ‘Delegate analytic functions list’ property. Select the checkbox and add the COUNT analytical function separated by commas.
2. Create a Selection view over the base view.
3. In the output tab add a new field with the field expression: count(*)over([<clause>][<byclause>]).
Note that the VirtualDataPort will not execute this analytical function, the query will be pushed down to the underlying data source.
If the underlying data source doesn’t support this analytical function, then you could enable a full cache mode on the base view with Cache database that supports the *count* analytical function. For more information on this, you could refer to section [Configuring the Cache of a View](https://community.denodo.com/docs/html/browse/7.0/vdp/administration/creating_derived_views/advanced_configuration_of_views/configuring_the_cache_of_a_view#configuring-the-cache-of-a-view) of Virtual DataPort Administration Guide.
In order to handle deadlocks in VirtualData Port, you could have a look at the KB article [Debugging deadlocks in Virtual DataPort](https://community.denodo.com/kb/view/document/Debugging%20deadlocks%20in%20Virtual%20DataPort?category=Common+Errors).
Hope this helps!