Jump to content

Edit History

LeviaMount

LeviaMount

On 11/10/2025 at 1:36 AM, Eolia said:

- Why use a regex when a built-in function does the job?

- You forgot a join on product_lang.

- The table is called product, not products.

- The other table is called manufacturer, not brands.

Your questions are justifiable, I explained you in basic terms with more clarity,  I just explained the basic structure so you can do it based on your requirements or database design. As you haven't mention any further details i can't help you to create clean and clear query. But Still I tried one more version and here it is

 

SELECT 
    p.product_id AS "Product ID",
    TRIM(BOTH ' ' FROM p.description) AS "Product Description",
    p.ean AS "EAN Code",
    m.manufacturer_name AS "Brand"
FROM 
    product p
JOIN 
    product_lang pl ON p.product_id = pl.product_id
JOIN 
    manufacturer m ON p.manufacturer_id = m.manufacturer_id
WHERE 
    pl.language_code = 'en'; -- Adjust for the desired language

 

LeviaMount

LeviaMount

On 11/10/2025 at 1:36 AM, Eolia said:

- Why use a regex when a built-in function does the job?

- You forgot a join on product_lang.

- The table is called product, not products.

- The other table is called manufacturer, not brands.

Your questions are justifiable, I explained you in basic terms more clarity,  I just explained the basic structure so you can you based on requirements or database design. As you haven't mention any further details i can't help you to create clean and clear query. But Still I tried one more version and here it is

 

SELECT 
    p.product_id AS "Product ID",
    TRIM(BOTH ' ' FROM p.description) AS "Product Description",
    p.ean AS "EAN Code",
    m.manufacturer_name AS "Brand"
FROM 
    product p
JOIN 
    product_lang pl ON p.product_id = pl.product_id
JOIN 
    manufacturer m ON p.manufacturer_id = m.manufacturer_id
WHERE 
    pl.language_code = 'en'; -- Adjust for the desired language

 

×
×
  • Create New...