简体   繁体   中英

PHP Group by and list all the other column

I have a table: 在此处输入图片说明

The select db is:

$select_table2 = '
SELECT e.product_clicks
     , e.product_id
     , e.website_url
     , u.name
     , u.product_id 
 FROM `oc_aa_affiliatecollclicktracking` AS e 
 LEFT      
 JOIN  `'.DB_PREFIX.'product_description` AS u 
    ON e.product_id = u.product_id 
 GROUP 
    BY e.website_url';

This will group it but won't list all product_id

I get:

http://127.0.01
        36

I'd like to group it but see all the product_id

http://127.0.01
    36
    40
    33
$select_table2 = 'SELECT `product_id` FROM `oc_aa_affiliatecollclicktracking` WHERE website_url LIKE '%http%';

如果您不想重复product_id

$select_table2 = 'SELECT DISTINCT(`product_id`) FROM `oc_aa_affiliatecollclicktracking` WHERE website_url LIKE '%http%';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM