on master help sign in
Improved sql
commit900da899662de67f765955f2294ac97ccbd9ca7d authoriko <ilyakooo0@gmail.com> dateSat 4 May 2019, 15:33 (7 years ago) parente141ccc
1 file changed+2−1
denis/src/Data/Query.hs+2−1
denis/src/Data/Query.hs+2−1
@@ -161,7 +161,8 @@ getAllUsersQ = selectStar $ from $ table #users
161161getPostsByIdQ :: [PostId] -> Maybe (Query Schema '[] (RowPG PostRowResponse))
162162getPostsByIdQ pIds = case idsToColumn pIds of
163163 Just idQ -> Just $ selectDotStar #posts $ from (subquery (idQ `As` #ids) &
164− innerJoin (subquery $ getPostQ (orderBy [#postElements ! #rowElementOrd & Asc] . orderBy [#posts ! #postRowId & Desc]) id `As` #posts)
164+ innerJoin (subquery $ getPostQ
165+ (orderBy [#postElements ! #rowElementId & Desc, #postElements ! #rowElementOrd & Asc]) id `As` #posts)
165166 (#ids ! #id .== #posts ! #postRowId))
166167 Nothing -> Nothing
167168