1

This is my query :

SELECT 
    MAX(c.CategoryID) as catID,
    c.EntityID,
    p.ProductID,
    pd.ProductName,
    cd.Name as Categorie,
    pd.Description,
    pd.MetaTitle,
    pd.MetaDescription,
    SUM(p.Price) AS Price,
    SUM(p.Stoc) AS Stoc,
    p.IsActive,
    MAX(CASE WHEN fd.FieldName='Volum' THEN TextValue ELSE NULL END) AS Volum,
    MAX(CASE WHEN fd.FieldName='Tip inchidere' THEN TextValue ELSE NULL END) AS TipInchidere,  
    MAX(CASE WHEN fd.FieldName='Ambalare palet' THEN TextValue ELSE NULL END) AS AmbalarePalet,
    MAX(CASE WHEN fd.FieldName='Ambalare bax' THEN TextValue ELSE NULL END) AS Ambalarebax,
    CONCAT('http://www.borcane.ro/images/',img.ParentType,'/', lpad(p.ProductID,8,'0'),'/',lpad(img.ID,8,'0'),'_large.JPG'),
    (
    SELECT 
    CONCAT('http://www.borcane.ro/images/',img2.ParentType,'/',lpad(p.ProductID,8,'0'),'/',lpad(img2.ID,8,'0'),'_large.JPG') 

    FROM images_images img2
    ) as ImageLinks
FROM 
    products_products p
    LEFT JOIN products_products_details pd
        on pd.ProductID = p.ProductID
    LEFT JOIN fld_chosenvalues f
        on f.ProductID = p.ProductID
    INNER JOIN fld_fields_details fd
        ON f.FieldID = fd.FieldID
    INNER JOIN g_categories_relations c
        ON p.ProductID = c.EntityID
    INNER JOIN g_category_details cd
        ON  c.CategoryID = cd.ID
    INNER JOIN images_images img
        ON img.ParentID = p.ProductID

WHERE  
    pd.Locale = 'ro-RO' 
    AND fd.Locale = 'ro-RO'
    AND cd.Locale = 'ro-RO'
GROUP BY
    p.ProductID,
    pd.ProductName,
    p.IsActive

so the problem is here : CONCAT('http://www.borcane.ro/images/',img2.ParentType,'/',lpad(p.ProductID,8,'0'),'/',lpad(img2.ID,8,'0'),'_large.JPG') it returns more then one element, i know that, BUT i want in order to return me all of the result, i want to get all of the result in one ROW. for example: enter image description here

This my case the it not returns numbers, but the concatanion result. How can i do that ?

Attila Naghi
  • 2,535
  • 6
  • 37
  • 59
  • 1
    You've not tagged a specific DBMS, but in [this answer](http://stackoverflow.com/a/10796492/1048425) the ways to do it in SQL Server, MySQL, SQLIte, Oracle and Postgresql are covered, should help you out. – GarethD Jun 26 '14 at 12:26

0 Answers0