SQL with clause

QuestionsSQL with clause
Ed K asked 2 weeks 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 2 weeks 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
PHP Grid Framework
 
Ed K answered 2 weeks 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 2 weeks 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
PHP Grid Framework
 
Ed K answered 2 weeks ago

thanks – this works great!

Your Answer

9 + 10 =

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 / 5. Vote count:

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

Let us improve this post!