bicycle
bicycle

Reputation: 8430

MySQL is reporting CONCAT doesn't exists

For some reason there's an error in the following query, it gives "FUNCTION j.CONCAT does not exist" When i remove the concat and just put .price there's no problem so the problem must be somewhere in the concat... The sql retrieves the bought also items from the database.

SELECT k.productid_with             AS productid_with, 
   g.product                    AS product_with_product, 
   j.CONCAT('€ ', price)   AS productid_with_price, 
   Replace(o.image_path, 
   '/home/user/domains/domain.com/public_html', 
   'http://www.domain.com') AS productid_with_image, 
   Replace(l.image_path, 
   '/home/user/domains/domain.com/public_html', 
   'http://www.domain.com') AS productid_with_bigImage, 
   k.productid, 
   h.product, 
   i.CONCAT('€ ', price) AS price, 
   Replace(m.image_path, 
   '/home/user/domains/domain.com/public_html', 
   'http://www.domain.com') AS image, 
   Replace(n.image_path, 
   '/home/user/domains/domain.com/public_html', 
   'http://www.domain.com') AS bigImage 
FROM   xcart_also_bought k 
   JOIN xcart_products_categories c 
     ON c.productid = 8863 
   JOIN xcart_categories d 
     ON c.categoryid = d.categoryid 
        AND d.parentid = 0 
   JOIN xcart_products a 
     ON k.productid_with = a.productid 
        AND a.forsale = 'Y' 
   JOIN xcart_products_categories e 
     ON a.productid = e.productid 
        AND e.categoryid = d.categoryid 
   JOIN xcart_products_lng g 
     ON a.productid = g.productid 
   JOIN xcart_pricing j 
     ON a.productid = j.productid 
   JOIN xcart_thumbnails o 
     ON a.productid = o.productid 
   JOIN xcart_bigthumbnails l 
     ON a.productid = l.productid 
   JOIN xcart_products b 
     ON k.productid = b.productid 
        AND b.forsale = 'Y' 
   JOIN xcart_products_categories f 
     ON b.productid = f.productid 
        AND f.categoryid = d.categoryid 
   JOIN xcart_products_lng h 
     ON b.productid = h.productid 
   JOIN xcart_pricing i 
     ON b.productid = i.productid 
   JOIN xcart_thumbnails m 
     ON b.productid = m.productid 
   JOIN xcart_bigthumbnails n 
     ON b.productid = n.productid 
WHERE  ( k.productid = '8863' 
      OR k.productid_with = '8863' ) 
ORDER  BY bought DESC 

Upvotes: 0

Views: 670

Answers (1)

bonCodigo
bonCodigo

Reputation: 14361

Can you use it like this please?

CONCAT('€ ', j.price)   AS productid_with_price, 

CONCAT('€ ', i.price) AS price, 

And to tell you a secret :D MYSQL doesn't have j.CONCAT and i.CONCAT ........... It only has CONCAT

To point out explicitly, you are putting table alias on CONCAT function where as you should put it on your fields :)

Upvotes: 3

Related Questions