Updating to MariaDB 10.6.12 broke my query

90 Views Asked by At

I recently upgraded my web server, which also upgraded my MariaDB server. I have a script I've used for several years that takes a CSV file, parses it for specific info, and loads that into a new csv file which it then emails to me. Today was the first time the cron job tried to run the query since upgrading and it is now giving me the following error.

There was an error during processing of the order query. You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'FROM products p, products_description pd, product_music_extra pme, reco...' at line 17

The full query is as follows

SELECT 'Label', 'Catalog #', 'UPC', 'CFG', 'Artist', 'Title', 'Price 1', 'QTY', 'Genre', 'Release Date'
        UNION ALL
        SELECT
    rc.record_company_name as Label,
    p.products_sku as 'Catalog #',
    p.products_model as UPC,
    cd.categories_name as CFG,
    ra.artists_name as Artist,
    pd.products_name as Title,
    p.products_group_a_price as 'Price 1',
    p.products_quantity as QTY,
    mg.music_genre_name as Genre,
    DATE_FORMAT(p.products_date_available,'%m/%d/%Y') as 'Release Date'
        INTO OUTFILE '/temp/soh_catalog.csv'
        FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\"'
        LINES TERMINATED BY '\r\n'
        FROM products p,
        products_description pd,
        product_music_extra pme,
        record_artists ra,
        music_genre mg,
        record_company rc,
        products_to_categories p2c,
        categories c,
        categories_description cd
            WHERE p.products_id = pd.products_id
            and p.products_id = pme.products_id
            and p.products_id = p2c.products_id
            and pme.artists_id = ra.artists_id
            and pme.record_company_id = rc.record_company_id
            and pme.music_genre_id = mg.music_genre_id
            and p2c.categories_id = c.categories_id
            and c.categories_id = cd.categories_id
            and p2c.categories_id != '31'
            and p2c.categories_id != '21'
            and p2c.categories_id != '22'
            and p2c.categories_id != '23'
            and p2c.categories_id != '24'
            and p2c.categories_id != '25'
            and p2c.categories_id != '41'
            and p.products_status = '1'

I appreciate any help someone can give!

None of the following changed the error statement. I tried changing 'Catalog #' to 'Catalog' in both places. I tried changing FIELDS TERMINATED BY ';' to FIELDS TERMINATED BY ';, \t\r\n' I tried removing the /r from LINES TERMINATED BY

0

There are 0 best solutions below