November 18, 2008 at 6:14 pm
Hi Experts,
Need your help on how to display my 3 columns coming from 3 different tables. I have 3 Tables with 1 column.
create table DimLab1 (idno int,
WidthData float )
insert into dimlab1 values (1,2.2)
insert into dimlab1 values (2,3.2)
insert into dimlab1 values (3,2.5)
create table DimLab2 (idno int,
WidthData float )
insert into dimlab2 values (1,6.2)
insert into dimlab2 values (2,5.2)
insert into dimlab2 values (3,8.5)
create table DimLab3 (idno int,
WidthData float )
insert into dimlab3 values (1,3.3)
insert into dimlab3 values (2,8.2)
insert into dimlab3 values (3,7.5)
select a.widthdata, b.widthdata, c.widthdata
from dimlab1 a, dimlab2 b, dimlab3 c
I need to display the widhdata from dimlab1, dimlab2, dimlab3 in 3 consecutive row but it display 27 rows when i use the select query.
Any advice?
Appreciate your help.
November 18, 2008 at 6:22 pm
Please read the article in my signature on how to post table definition / sample data here. This could be very simple or somewhat difficult depending on the structure of these 3 tables.
November 18, 2008 at 10:09 pm
Would the number of rows always remain the same in all tables?
Suggestion: Please don't edit the post in a way by which the continuity of the thread is affected.
November 18, 2008 at 10:13 pm
yes, the number of rows remains the same in all tables.
November 18, 2008 at 10:19 pm
Would this help
SELECT a.widthdata AS col1,
b.widthdata AS col2,
c.widthdata AS col3
from dimlab1 a
inner join dimlab2 b
on a.idno = b.idno
inner join dimlab3 c
on b.idno = c.idno
November 18, 2008 at 10:24 pm
arnold (11/18/2008)
yes, the number of rows remains the same in all tables.
could you tell what exact output of query.
November 18, 2008 at 10:34 pm
arnold (11/18/2008)
Hi Experts,Need your help on how to display my 3 columns coming from 3 different tables. I have 3 Tables with 1 column.
create table DimLab1 (idno int,
WidthData float )
insert into dimlab1 values (1,2.2)
insert into dimlab1 values (2,3.2)
insert into dimlab1 values (3,2.5)
create table DimLab2 (idno int,
WidthData float )
insert into dimlab2 values (1,6.2)
insert into dimlab2 values (2,5.2)
insert into dimlab2 values (3,8.5)
create table DimLab3 (idno int,
WidthData float )
insert into dimlab3 values (1,3.3)
insert into dimlab3 values (2,8.2)
insert into dimlab3 values (3,7.5)
select a.widthdata, b.widthdata, c.widthdata
from dimlab1 a, dimlab2 b, dimlab3 c
I need to display the widhdata from dimlab1, dimlab2, dimlab3 in 3 consecutive row but it display 27 rows when i use the select query.
Any advice?
Appreciate your help.
what is the output??
kshitij kumar
kshitij@krayknot.com
www.krayknot.com
November 18, 2008 at 10:37 pm
Please take note that their IDNO does not have any relationship between each table.
i need an output like this irregardless of IDNO:
Dimlab1Widthdata Dimlab2Widthdata Dimlab3Widthdata
2.2 6.2 3.3
3.2 5.2 8.2
2.5 8.5 7.5
Thanks
November 18, 2008 at 10:51 pm
I suggest you created temp tables with identity columns. Insert your data in order and then select the data by joining on the identity columns.
"Keep Trying"
November 19, 2008 at 12:03 am
Chirag (11/18/2008)
I suggest you created temp tables with identity columns. Insert your data in order and then select the data by joining on the identity columns.
Thanks for your advice and I think it's possible in that way.
Is there a better way to display it in only one select statement without using the memory resources?
November 19, 2008 at 2:30 am
Whats the amount of data that we are dealing with?
"Keep Trying"
November 19, 2008 at 4:35 pm
Chirag (11/19/2008)
Whats the amount of data that we are dealing with?
Thousand of rows.
November 19, 2008 at 7:58 pm
I try this one and it works, I beginners just practicing...
November 19, 2008 at 10:07 pm
sarbhika (11/19/2008)
I try this one and it works, I beginners just practicing...
What did your try?
November 19, 2008 at 10:40 pm
arnold (11/19/2008)
Chirag (11/19/2008)
Whats the amount of data that we are dealing with?Thousand of rows.
I believe you could do this using complex T-SQL but even that would consume memory. Using temp tables has an advantage that they can have indexes. Using proper indexes can speed up your queries.
BTW thousands of rows is quite normal in most cases. Should not be a problem.
"Keep Trying"
Viewing 15 posts - 1 through 15 (of 16 total)
You must be logged in to reply to this topic. Login to reply