![]() JOIN PostTags pt2 ON pt1.PostId = pt2.PostId ![]() Select: %Įither way, the query will give you one device with its info and most recent location all in one query.SELECT t1.TagName AS, t2.TagName AS, COUNT(pt1.PostId) AS # You can structure this select any way you like Inner_lateral_join: dl in subquery(location_query), # Use the same alias as specified in the subquery Inner_join: di as assoc(pd, :device_info), Then join to it from ProvisionedDevice: query = # Order by inserted at to get the most recent entry ![]() Where: parent_as(:d_info).id = dl.device_info_id, You will want to create a subquery for the locations: location_query = I don't know if this can be done in a preload, but you can use lateral joins (section 7.2.1.5) to achieve what you want.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |