Closed filipagh closed 3 months ago
Here the From
will not conserve the inner With
, using an outer With
will do.
This example should work.
var activePosts = new Query("Comments")
.Select("PostId")
.SelectRaw("count(1) as Count")
.GroupBy("PostId")
.HavingRaw("count(1) > 100");
var queryWith = new Query("ActivePosts")
.With("ActivePosts", activePosts) // now you can consider ActivePosts as a regular table in the database
.Join("ActivePosts", "ActivePosts.PostId", "Posts.Id");
var query = new Query().With("sub", queryWith).From("sub");
yes this worked, thanks
hi maybe im not doing something wrong but i have complicated query with
with
defined in sub query, and compiled query is missingwith
partminimal changed docs example
result :
SELECT * FROM ( SELECT * FROM [ActivePosts] INNER JOIN [ActivePosts] ON [ActivePosts].[PostId] = [Posts].[Id] )
WITH "ActivePosts" as
is missing