Query with 3 tables

Posts   
 
    
lenino
User
Posts: 13
Joined: 27-Apr-2009
# Posted on: 09-Jun-2009 16:29:27   

How I can do the next query with entities:

SELECT COUNT(W.EMP_ID) AS NRO FROM WEB_ACCESS W,EMPLOYEE E,USERS U WHERE W.EMP_ID = E.EMP_ID AND W.USER_ID = U.USER_ID AND W.ACCESS_STATUS = 'A' AND U.STATUS = 'A'

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 09-Jun-2009 20:38:46   

You can't do this using entities as you are COUNTing the rows in the table - the two things are kinda mutually exclusive...

Take a look at the documentation for Aggregate functions in scalar queries which will allow you do what you need.

Matt