• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 487
  • 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
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

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