By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,587 Members | 1,168 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,587 IT Pros & Developers. It's quick & easy.

how to display separate field after a condition

P: 6
hi,

thanks for heping me in my previous issues....i m really confused reg this issue, please help me:

i'm selecting a row from table a for that particular row there are 3 persons
(assignee, login person and the persontaking action)
whose name i should display, the 3 people info are stored in different table(table c) so
only there ids are stored in the table a - row

how to dipslay there names in 3 different fields ;;;if i use the below code:

select a.column1(assignee-id1), a.column(reported-id2), a.column(takingaction-id3) , c.firstname,c.lastname
from table a, table c
where c.id = a.assignee-id1 or a.reported-id2 or a.takingaction-id3

--- it gives me 3 duplicate entries of the same row, i wanted a single row with 3 names
defined in 3 separate fields...please help me to solve this issue....i dont know how to se condition and
store the result of the condition in separate field in sql syntax

thanks in tons in advance
Dec 12 '06 #1
Share this Question
Share on Google+
2 Replies


iburyak
Expert 100+
P: 1,017
Try something like this:

[PHP]select a1.column1(assignee-id1), a2.column(reported-id2), a3.column(takingaction-id3) , c.firstname,c.lastname
from table c
join table a1 on c.id = a1.assignee-id1
join table a2 on c.id = a2.reported-id2
join table a3 on c.id = a3.takingaction-id3[/PHP]
Dec 12 '06 #2

scripto
100+
P: 143
i hope this helps

select c1.firstname+' '+c1.lastname, c2.firstname+' '+c2.lastname,c3.firstname+' '+c3.lastname
from table a inner join table c1 on a.assignee-id1 = c1.id
inner join table c2 on a.reported-id2 = c2.id
inner join table c3 on a.takingaction-id3 = c3.id
Dec 12 '06 #3

Post your reply

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