Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Joining Tables in Oracle SQL Developer

I have four tables that I want to join and display the output all together. I'm not sure how the syntax works for Oracle SQL Developer. I know this is an easy question for a programmer and I was hoping someone can make a suggestion on how the code might look like.

The tables are:

JNL1
JNL2
JNL3
JNL4

The key that is common between all four of these tables is ItemID.

How would the query look like? Thanks

like image 851
K J Avatar asked May 20 '26 15:05

K J


1 Answers

It really depends on what kind of join you want (outer or not) but you can use default SQL syntax.

For example, joining without the JOIN keyword:

select * from JNL1, JNL2, JNL3, JNL4,
where 
JNL1.ItemID = JNL2.ItemID AND
JNL2.ItemID = JNL3.ItemID AND
JNL3.ItemID = JNL4.ItemID;

Additionally you can make use of multiple INNER JOINS e.g.

SELECT whatever
  FROM JNL1 AS a
INNER 
  JOIN JNL2 AS b
    ON b.ItemID = a.ItemID
INNER 
  JOIN JNL2 AS c
     ON c.ItemID = b.ItemID
INNER 
  JOIN JNL2 AS d
     ON d.ItemID = c.ItemID
like image 54
Menelaos Avatar answered May 22 '26 12:05

Menelaos



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!