Dino Geek, try to help you

How to use FULL OUTER JOIN in MariaDB?


MariaDB does not support the FULL OUTER JOIN explicitly. However, you can achieve the same result by combining LEFT JOIN and RIGHT JOIN or using UNION or UNION ALL keyword.

Here’s an example:

```
SELECT *
FROM table1
LEFT JOIN table2 ON table1.id = table2.id
UNION
SELECT *
FROM table1
RIGHT JOIN table2 ON table1.id = table2.id
```

In this example, we are joining table1 and table2 on id. The LEFT JOIN collects all records from table1 and the matched records from table2. The RIGHT JOIN collects all records from table2 and the matched records from table1. The UNION combines these two results to simulate a full outer join.

Please note UNION removes duplicate rows, if you want to keep all duplicates you should use UNION ALL:

```
SELECT *
FROM table1
LEFT JOIN table2 ON table1.id = table2.id
UNION ALL
SELECT *
FROM table1
RIGHT JOIN table2 ON table1.id = table2.id
```

Make sure the columns in your selected list are in the same order and are of compatible data types for the UNION or UNION ALL to work.


Simply generate articles to optimize your SEO
Simply generate articles to optimize your SEO





DinoGeek offers simple articles on complex technologies

Would you like to be quoted in this article? It's very simple, contact us at dino@eiki.fr

CSS | NodeJS | DNS | DMARC | MAPI | NNTP | htaccess | PHP | HTTPS | Drupal | WEB3 | LLM | Wordpress | TLD | Domain name | IMAP | TCP | NFT | MariaDB | FTP | Zigbee | NMAP | SNMP | SEO | E-Mail | LXC | HTTP | MangoDB | SFTP | RAG | SSH | HTML | ChatGPT API | OSPF | JavaScript | Docker | OpenVZ | ChatGPT | VPS | ZIMBRA | SPF | UDP | Joomla | IPV6 | BGP | Django | Reactjs | DKIM | VMWare | RSYNC | Python | TFTP | Webdav | FAAS | Apache | IPV4 | LDAP | POP3 | SMTP

| Whispers of love (API) | Déclaration d'Amour |






Legal Notice / General Conditions of Use