• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 483
  • Last Modified:

Need sql query to retrieve result

these are my sql tables. how can i get the result here..
my table desription..


Table 1
...........
Col1 pk
Col2

Table 2
..........
Col3 pk
Col4

Table3
...........
col3 fk
col1 fk
col5

Now i want data like this

result is
.......
col2
col4

Here col2 and col4 as a single column(concatination).

Here my sql statement is failed to retrieve result..

Can anyone know sql query to get result..
0
lucky20
Asked:
lucky20
1 Solution
 
jimyXCommented:
Select Col2 from Table1 union select Col4 from Table2 union select col5 from Table3
0
 
jimyXCommented:
To allow duplicate values use union all:
Select Col2 from Table1 union all select Col4 from Table2 union all select col5 from Table3
0
 
jimyXCommented:
Not sure i got your point there but if you just want Col2 and Col4 then:

Select Col2 from Table1 union all select Col4 from Table2
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
bitrefCommented:
Select t1.col2, t2.col4
From t1
	Inner Join t3 on t1.col1 = t3.col1
	Inner Join t2 on t3.col3 = t2.col3

Open in new window

0
 
Ephraim WangoyaCommented:

Select Col2
from Table1
union all
select Col4
from Table1
inner join Table2 on Table2.Col3=Table1.Col1
0
 
lucky20Author Commented:
thanks to every one..
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now