This topic is locked

SQLView

8/14/2020 1:46:00 PM
PHPRunner General questions
G
Grdimitris author

I have a mariadb table where i want to turn the distinct values of a column to turn to columns

the table is a0_biologika and fields are

id = int AUTO_INCREMENT (primary key)

afm = varchar(9) not null

etos = varchar(4) not null
i found sql code that works in phpMyAdmin. The code is
SELECT

GROUP_CONCAT(DISTINCT

CONCAT(

'ifnull(SUM(case when etos= ''',

etos,

''' then 1 end),0) AS ',
etos, '
'

)

) INTO @sql

FROM

a0_biologika ;
SET @sql = CONCAT('SELECT afm, ', @sql, '

FROM a0_biologika

GROUP BY afm);
PREPARE stmt FROM @sql;

EXECUTE stmt;

DEALLOCATE PREPARE stmt;
This code produces a view with column afm and every distinct value of column etos as separate column with value 1 if exist or 0 if not
How to transfer it to PHPRunner? I think from Create SQLView but it produces a syntax error. Because it runs in phpMyAdmin i cant find the error.

HJB 8/15/2020

Cross-tab reports



PHPRunner supports cross-tab reports (often called pivot tables). On the Group fields screen, you can choose two or more variables (columns) and assign them to the X or Y-axis. You can assign more than one variable to the axis and switch between them in the generated report. Unquote excerpt ex https://xlinesoft.com/phprunner/docs/creating_and_configuring_reports.htm
Certainly NOT a direct and wished answer to your current coding problems, so, above is for inspiration purposes only. There are so many built-in features inside PHPR that don't require manual coding, but of course cannot serve and suit all individual needs just like that.

Sergey Kornilov admin 8/17/2020

Use cross-tab reports in PHPRunner.