Hello,
I have been using QueryDsl SQL Module version 4.1.3. How do you do the following?
select
foo.action_id, foo.data, foo.date, foo.rank, foo.name
from
(select tbl_event_logs.action_id, tbl_event_logs.data, tbl_event_logs.date, tbl_themes.name,
rank() over (partition by tbl_event_logs.subject_id order by tbl_event_logs.date desc) as rank
from tbl_event_logs tbl_event_logs
join tbl_themes tbl_themes
on tbl_themes.id = tbl_event_logs.subject_id
where tbl_event_logs.user_id = 10 and tbl_event_logs.action_id = 18
order by tbl_event_logs.date desc) as foo
where foo.rank = 1
Note the following,
1. I have a sub-query in the FROM clause.
2. I am using PostgreSQL and hence the sub-query requires an alias ("foo" in the above instance)
3. The sub-query joins two tables (tbl_event_logs and themes) and is returning columns from both the tables.
4. In the main query, I need the columns returned from both the tables.
Thanks in advance