0

I have a error in my SQL:

"SELECT * FROM tireOverview FULL OUTER JOIN tirePrice ON tireOverview.ID=tirePrice.IDtire"

Where i get this error:

Fatal error: Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 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 'OUTER JOIN tirePrice ON tireOverview.ID=tirePrice.IDtire ORDER BY tireOvervie...' at line 1 in /var/www/html/webscraper/scraper/include.php:158 Stack trace: #0 /var/www/html/webscraper/scraper/include.php(158): PDOStatement->execute() #1 /var/www/html/webscraper/scraper/index.php(34): tireReadOut(Object(PDO)) #2 {main} thrown in /var/www/html/webscraper/scraper/include.php on line 158

My Database consists of 2 tables:

tireOverview -> ID, EAN, ProductName, Date, URLAutoweek

tirePrice -> ID, IDtire (fk tireOverview.ID), Seller(fk Sellers.ID), PriceAutoweek, PositionAutoweek, PriceJSON, LastChanged

I want to get all the data from where tireOverview.ID matches tirePrice.IDtire.

Database is mariaDB, with PHPMyAdmin. Server is Debian 10 (Buster). PHP is version 7.3.

If you need more info, just comment!

7
  • 4
    MySQL/MariaDB does not implement FULL joins. Commented Nov 3, 2020 at 9:24
  • Possible similiar to stackoverflow.com/questions/2384298/… Commented Nov 3, 2020 at 9:27
  • 1
    In MySQL you should use LEFT OUTER JOIN or RIGHT OUTER JOIN. There is no just OUTER JOIN. If you need FULL OUTER JOIN in MySql you can use UNION of LEFT JOIN and RIGHT JOIN Commented Nov 3, 2020 at 9:28
  • @BhAvikGajjar Thank you for directing me in the good direction, searched for 30 minutes but didn't find that page. Commented Nov 3, 2020 at 9:29
  • @Zegert Welcome ! Hope this will help you SELECT * FROM company C LEFT JOIN company_address A ON C.company_id = A.company_id WHERE A.company_id IS NULL Commented Nov 3, 2020 at 9:30

1 Answer 1

0

As Akina said: "MySQL/MariaDB does not implement FULL joins.", but you can do:

SELECT * FROM company C LEFT JOIN company_address A ON C.company_id = A.company_id WHERE A.company_id IS NULL

Sources:

How to do a FULL OUTER JOIN in MySQL?

Why does MySQL report a syntax error on FULL OUTER JOIN?

Credits: @Akina & @BhAvik Gajjar

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.