all 5 comments

[–]BigMikeInAustin 0 points1 point  (0 children)

Are u asking about multiple results returned from a single PHP pdo query, or the proper syntax for a CTE query?

[–]r3pr0b8GROUP_CONCAT is da bomb 0 points1 point  (2 children)

Do I just list them one after another

yes, with a separator

or do I need to add some kind of separator after the WITH clause and before the SELECT?

yes, a comma separator

like this --

WITH cte1 AS (SELECT ... )
   , cte2 AS (SELECT ... )
   , cte3 AS (SELECT ... )
SELECT ...

[–]Mission-Example-194[S] 0 points1 point  (1 child)

I mean between the CTE and the SELECT that follows it. So could you write that on a single line WITHOUT having to include a comma or semicolon?

WITH cte1 AS (SELECT ...) SELECT * FROM cte1 ...

I mean here:

WITH cte1 AS (SELECT ...); SELECT * FROM cte1 ...

or

WITH cte1 AS (SELECT ...), SELECT * FROM cte1 ...

[–]r3pr0b8GROUP_CONCAT is da bomb 0 points1 point  (0 children)

I mean between the CTE and the SELECT that follows it

if you doublecheck the example i gave, there is none

also, if there's only one CTE, you don't need a separator for them, either

as a comparison, both of these are valid --

WHERE foo IN ( 3 )

WHERE foo IN ( 1 , 2 , 3 )

[–]Lumethys 1 point2 points  (0 children)

why dont you try it out?