Friday, February 26, 2016

Projection in Dynamic Query



Today we will discuss about Projection in Dynamic Query .Before reading this blog it is highly recommended to read my previous blog on introduction of dynamic query. We know how to fetch a complete object but what if we want only one column like only userId of User for this we use Projections.

Lets start with example:-

1)Select query for One column
Here we write a query that will return only userId:-





2)Select query for Two columns
Here we write a query that will return only userId and firstname:-




3)Select query for Aggregate functions
Projection is also used for aggregate function like SUM, MAX, COUNT, AVG etc. Aggregate function always return single value.



Hope this will Help....

Related Post:-

No comments:

Post a Comment

Total Pageviews

Number Of Unique Visitor

Free counters!