SQL with clause

QuestionsSQL with clause
Ed K asked 5 years ago

Do you have any plans to support SQL “with” statements?

ex:

with tempTable as (select….)

select *

from tablleA

inner join tempTable on…

4 Answers
Abu Ghufran Staff answered 5 years ago

Hello,

I’ve verified WITH clause on postgres database and it perform listing, search, sort, paging correctly.

Sample: https://gist.github.com/52cf1e394dd2fe159185f3944365d669

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Ed K answered 5 years ago

Example:

with item as (select stco, ststyl, stssfx from ststyl00)
select * from pdpick00
inner join item on stco = pdco and pdstyl = ststyl and pdssfx = stssfx

Generates error:

Couldn’t execute query. Keyword AS not expected. Valid tokens: FULL LEFT CROSS INNER RIGHT EXCEPTION. SQLCODE=-199 – SELECT count(*) as c FROM (with item as (select stco, ststyl, stssfx from ststyl00) select * from pdpick00 inner join item on stco = pdco and pdstyl = ststyl and pdssfx = stssfx WHERE 1=1) pg_tmp

Abu Ghufran Staff answered 5 years ago

I’ve updated same demo code, you can set custom count query if grid is not generating correct, by this:

https://gist.github.com/gridphp/52cf1e394dd2fe159185f3944365d669#file-db-layer-pgsql-php-L40

 

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Ed K answered 5 years ago

thanks – this works great!

Your Answer

3 + 15 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?