Terminé

Datatables server-side processing - PHP / PostgreSQL - advanced queries

I´m trying to figure out how to group data from joined table in Datatables server-side PHP script.

The data for datatables in prepared by the PHP script using an SSP class modified for postgreSQL connection.

The table consists of products and their categories.

Everything is working well, but I cannot figure out how to prepare the SELECT statement in order to group product categories per product.

To make it easier to understand my problem you can see a setup example below.

PostgreSQL DB table structure:

Table: products_table

------------------------------------------

id | title | pr_template_id

------------------------------------------

1 | Product 1 | 1

2 | Product 2 | 2

3 | Product 3 | 3

------------------------------------------

Table: product_categories_template_relations

------------------------------------------

id | pr_template_id | category_id

------------------------------------------

1 | 1 | 1

2 | 1 | 2

3 | 2 | 2

4 | 2 | 3

5 | 3 | 1

------------------------------------------

Table: product_categories

------------------------------------------

category_id | title

------------------------------------------

1 | Category 1

2 | Category 2

3 | Category 3

------------------------------------------

Server side script (PHP):

<?php

$table = <<<EOT

(

SELECT

[login to view URL],

a.pr_template_id,

[login to view URL] as producttitle,

b.pr_template_id,

b.category_id,

[login to view URL] as cattitle

FROM products_table a

LEFT JOIN product_categories_template_relations b ON a.pr_template_id = b.pr_template_id

LEFT JOIN product_categories c ON b.category_id = c.category_id

) temp

EOT;

?>

Current Datatables results:

------------------------------------------

Product ID | Product title | Category

------------------------------------------

1 | Product 1 | Category 1

1 | Product 1 | Category 2

2 | Product 2 | Category 2

2 | Product 2 | Category 3

3 | Product 3 | Category 1

------------------------------------------

Datatables results I´m looking for:

---------------------------------------------------------

Product ID | Product title | Category

---------------------------------------------------------

1 | Product 1 | Category 1, Category 2

2 | Product 2 | Category 2, Category 3

3 | Product 3 | Category 1

---------------------------------------------------------

So basically I´m currently stuck at Server side script (PHP) and how to formulate the SQL query correctly.

I only accept bids from developers with specific experience in advanced Datatables server-side scripting.


Please also see this description of the problem:
https://stackoverflow.com/questions/51042935/datatables-server-side-php-using-ssp-class-how-to-group-after-join

Compétences : Datatables, PHP, PostgreSQL

en voir plus : database queries show php site, ajax php postgresql, mysql sql server oracle db2 postgresql, jquery datatable server side pagination example php, datatables server side processing with post example, datatables server side columns, datatables server side parameters, jquery datatable server side pagination, datatable server side false, datatables server side search, datatable demo (server side) in php,mysql and ajax, php, postgresql, php mysql advanced, web service php postgresql pear, freelance php postgresql javascript, php postgresql ajax, php postgresql outsourcing, processing python postgresql, advanced search options php

Concernant l'employeur :
( 24 commentaires ) Ringsted, Denmark

Nº du projet : #17247154

Décerné à:

phiona06

You need use this script SELECT [login to view URL], [login to view URL] as producttitle, string_agg(DISTINCT [login to view URL], ',') as cattitle FROM products_table a LEFT JOIN product_categories_template_relations b ON a.pr_template_id Plus

%selectedBids___i_sum_sub_7% %project_currencyDetails_sign_sub_8% USD en 0 jours
(15 Commentaires)
4.4

18 freelance font une offre moyenne de $167 pour ce travail

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 5 jours
(30 Commentaires)
6.6
mamoona016

Datatables server-side processing - PHP / PostgreSQL - advanced queries Hello, I have read the details that you mentioned in your project description. I am willing to work with you on this project. I hope that we can Plus

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 3 jours
(65 Commentaires)
6.4
%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 2 jours
(237 Commentaires)
6.5
abugosia

Hello, I'm Abu Gosia. I'm interesting your project very well I'm good in Website Design, PHP, Laravel, Codeigneter, Wordpress, C#, .Net, MVC, Angular.js, ASP.NET expert. I m quite well experienced in these jobs. Le Plus

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 3 jours
(101 Commentaires)
6.5
schoudhary1553

Hello, I can help with you in your project Datatables server-side processing - PHP / PostgreSQL - advanced queries. I have more than 5 years of experience in Datatables, PHP, PostgreSQL. We have worked on several si Plus

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 3 jours
(26 Commentaires)
5.2
pakistansolution

Hi, I am server side expert. I have read your description i have understood what you want. Please get in touch so we can start your project. Thanks

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 2 jours
(45 Commentaires)
5.2
%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% USD en 1 jour
(33 Commentaires)
4.9
alexwmsoft

Hi I am experienced website developer. I read your job description carefully and I make sure I can complete your tasks perfect with high quality in a time.I have good experience in product category. In product Plus

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 3 jours
(5 Commentaires)
4.5
paulprabhakarand

Hi, I read your requirement and understood that you need some one good at PHP and Postgres SQL knowledge to write best queries on grouping. I am good at both the technologies, last week I developed and delivered an ap Plus

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 2 jours
(19 Commentaires)
4.6
businesstogether

Hi, I can start work on your project immediately once you confirm me and i am also open for further discussion if you want. I have 8+ years in web designing & development with good experience in following skills Plus

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 3 jours
(5 Commentaires)
4.5
rrgamit

HELLO SIR . HOW ARE YOU? I HAVE GONE THROUGH YOUR REQUIREMENT AND I AM SURE I CAN HELP YOU. I HAVE MORE THAN 7 YEARS EXPERIENCE IN CI, MYSQL, HTML, Graphic Design, PHP, Website Design. FOR FURTHER DISCUSS Plus

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 3 jours
(37 Commentaires)
4.1
%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 2 jours
(20 Commentaires)
4.0
techradiusptyltd

This Is Jessica Amy. I hope you are doing good. I read the project description and checked the your query. I will do this work, please share the all details. Please have a look at my work: [login to view URL] Plus

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 3 jours
(2 Commentaires)
2.9
cataldie

I’m an engineer, I have more than 5 years of experience on build website, app, wordpress, plugin, software. If you are looking for a professional and hard-working virtual assistant, you have found the right person! Plus

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 3 jours
(4 Commentaires)
3.0
promition

Hello Sir/Madam, Wish you a very good day. I have been working as a professional senior full stack developer for 5 long years now. I have spent my 5 years to get the best experience as a full stack developer using t Plus

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 3 jours
(3 Commentaires)
2.1
vandanavishwaka9

Hi, I have similar work experience in this work. i love to complete this task on given schedule. please share you requirement specification details.

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 7 jours
(5 Commentaires)
1.9
%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 4 jours
(0 Commentaires)
0.0