                     .with(cte)
                     .joining(required: cte.forKey("a"), on: { (left, right) in left["id"] > right["id"] })
                     .joining(required: cte.forKey("b"), on: { (left, right) in left["id"] > right["id"] })
-               try assertEqualSQL(db, request, """
-                WITH "t2" AS (SELECT * FROM "t") \
-                SELECT "t1".* \
-                FROM "t" "t1" \
-                JOIN "t2" ON "t1"."id" > "t2"."id"
-                """)
+                try assertEqualSQL(db, request, """
+                    WITH "t2" AS (SELECT * FROM "t") \
+                    SELECT "t1".* \
+                    FROM "t" "t1" \
+                    JOIN "t2" ON "t1"."id" > "t2"."id"
+                    """)
             }
+            
+//            // Use CTE as a subquery
+//            do {
+//                let cte = T.all()
+//                    .commonTableExpression()
+//                let request = T.all()
+//                    .with(cte)
+//                    .annotated(with: cte.all())
+//                try assertEqualSQL(db, request, """
+//                    WITH "foo" AS (SELECT * FROM "t") \
+//                    SELECT "t".*, (SELECT * FROM "foo") FROM "t"
+//                    """)
+//            }
         }
     }
 }

                let request = T.all()
                    .with(cte)
                try assertEqualSQL(db, request, """
                WITH "custom" AS (SELECT 'O''Brien') \
                SELECT "t".* FROM "t"
                """)
            }
            
            // Just add a WITH clause: sql request with conflicting key

                    .with(cte)
                    .joining(required: cte, on: { (left, right) in left["id"] > right["id"] })
                    .joining(required: cte, on: { (left, right) in left["id"] > right["id"] })
                try assertEqualSQL(db, request, """
                    WITH "t2" AS (SELECT * FROM "t") \
                    SELECT "t1".* \
                    FROM "t" "t1" \
                    JOIN "t2" ON "t1"."id" > "t2"."id"
                    """)
            }
            
            // Join two CTEs with same key but different condition
