473,465 Members | 1,538 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

What JOIN do I need?

dlite922
1,584 Recognized Expert Top Contributor
I know what a left join, right join and regular join-keyword-less joins do. But what if I want to display null on both tables/sides?

What i'm going to do if there's no full outer join in MySQL is take a union of inner and left joins.

Is this the only way?




Dan
Jan 31 '09 #1
1 1444
Atli
5,058 Recognized Expert Expert
Hi.

The only way I know to simulate a FULL OUTER JOIN is to take a UNION of LEFT and RIGHT joins.

Like, if I had these tables:
Expand|Select|Wrap|Line Numbers
  1. CREATE TABLE jA ( value int );
  2. CREATE TABLE jB ( value int );
  3. INSERT INTO jA VALUES (1), (2), (3);
  4. INSERT INTO jB VALUES (2), (3), (4);
A FULL OUTER JOIN could be simulated like so:
Expand|Select|Wrap|Line Numbers
  1. mysql> SELECT * FROM jA
  2.     -> LEFT JOIN jB
  3.     ->     ON jA.value = jB.value
  4.     -> UNION
  5.     -> SELECT * FROM jA
  6.     -> RIGHT JOIN jB
  7.     ->     ON jA.value = jB.value;
  8. +-------+-------+
  9. | value | value |
  10. +-------+-------+
  11. |     1 |  NULL | 
  12. |     2 |     2 | 
  13. |     3 |     3 | 
  14. |  NULL |     4 | 
  15. +-------+-------+
  16. 4 rows in set (0.00 sec)
  17.  
Feb 1 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Brett | last post by:
I'm developing with CF 5 and SQL Server 2000. I think they are both great products. The major draw is their cost. I don't develop stand alone products because anyone that wants to purchase them...
10
by: eLisHa | last post by:
i have an arraylist that gets it's values dynamiclly from the database, after paging, searching & more in the ASP.net file. What im trying to do, is sort the results that are sorted in the...
5
by: kathy | last post by:
To using ASP.NET on Windows 2000 Server, for both development and deployment, what I need?
0
by: Shane Story | last post by:
My other thread on serialization seemed to be stagnant and I still have questions, so I decided to post this example of what I need to know. I am trying to use binaryformatter. I have no trouble...
3
by: dotnetnoob | last post by:
this is my code Do Dim nn As String Dim strNetControl As String = CStr(arlsNetControl.Item(y)) rootDoc.Load(strNetControl) lsSubNetInst =...
2
by: engwar1 | last post by:
I'm a .Net newbie and have started writing a Windows Forms application to assist me in choosing files/directories to move from one drive to another. Basically what I want is something like the...
3
by: Woody Ling | last post by:
>From the DB2 UDB memory model document, I found the following info: ============================== The agent private memory set consist of the following memory pools. Their sizes are specified...
20
by: canabatz | last post by:
hi all !! i got my results like that 1 user0 55 2 user1 53 3 user2 49 4 user2 48 5 user3 47 <------- last inserted row 6 user4 46
5
by: Kaosman | last post by:
I have been trying to figure out this problem for a while. All I want to do is have a combo box populate a list box and the list box change to the record based on the users choice. The combo...
1
by: lmjoseph | last post by:
Hey guys & gals - I need to know what I need. Im trying to start an online business directory. If I wanted to build a hybrid site between yellowpages.com and angieslist.com, what do I need so I...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.