Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Join

Author  Topic 

Amjath
Yak Posting Veteran

66 Posts

Posted - 2007-02-12 : 21:08:40
Hi All,
I have two different table no relation between them, but i want to join the 2 table how can i do this, plz help me....some thing like this
(Table1)
SELECT TestId, Station, [Data Required], Criteria FROM RouteCard WHERE StationID = '7' AND AllModel = 1 AND Active = 1
OUTER JOIN
(Table2)
SELECT BIS.Summary_Rate AS Reading, BIS.Summary_Pass AS Result
FROM RouteCardEntryDetails AS RED
INNER JOIN BurnInStation AS BIS ON RED.MACAddress = BIS.MACAddress

Thanks And Regards
Amjath

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-02-12 : 21:18:04
you want a CROSS JOIN ?

select *
from
(
SELECT TestId, Station, [Data Required], Criteria FROM RouteCard WHERE StationID = '7' AND AllModel = 1 AND Active = 1
) a
cross join
(
SELECT BIS.Summary_Rate AS Reading, BIS.Summary_Pass AS Result
FROM RouteCardEntryDetails AS RED
INNER JOIN BurnInStation AS BIS ON RED.MACAddress = BIS.MACAddress
) b



KH

Go to Top of Page

Amjath
Yak Posting Veteran

66 Posts

Posted - 2007-02-12 : 21:40:49
it gives mXn result.
for example 1 table have 2 rows and 2 table have 2 rows the result will contain 4 rows.

my need is i want only 2 rows as a resultant for example 1 rows of 1 table join with 1 row of 2 table.

in that case when 1 table contain 2 rows and second table contains 1 row then the resultant contain 2 rows only and the value for the 2 row iin 2 table should be null

how can i get this
plz help me

Thanks and Regards
Amjath
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-02-12 : 21:42:52
quote:
my need is i want only 2 rows as a resultant for example 1 rows of 1 table join with 1 row of 2 table.

Well, you have to specify HOW TO JOIN. Without any information, i can only assume CROSS JOIN


KH

Go to Top of Page

Amjath
Yak Posting Veteran

66 Posts

Posted - 2007-02-12 : 21:52:57
HI Khtan, let me explain in detail
i)i have two different table without any relation between them...
ii)i want to join this two table(1 to 1 mapping).
take cases
for example
table 1-rows 2 table 2-rows o
then resultant contain 2-rows only and the column of table 2 become null.
like this

can we do this
thanks and regards
Amjath
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-02-13 : 01:02:33
I think you better supplt some sample data and your expected output based on the sample data you provide.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -