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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 Other SQL Server 2012 Topics
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Shaimaa T
Starting Member

1 Posts

Posted - 08/22/2014 :  09:32:53  Show Profile  Reply with Quote
Hi all,

Can someone help explain to me how when I have 12 rows in table A and 10 in B and I do an inner join , I would get more rows than in both A and B ?

Same with left and right joins...

This is just a simplified example. Let me share one of my issues with you

I have 2 views ; which was originally SQL on 2 base tables Culture and Trials.

And then when attempting to add another table Culture Steps, one of the team members separated the SQL into 2 views

Since this produces an error when updating(modification cannot be done as it affects multiple base tables), I would like to get back to changing the SQL such that I no longer use the views but achieve the same results.

One of the views has

SELECT       some columns
FROM            dbo.Culture RIGHT JOIN
                         dbo.Trial ON dbo.Culture.cultureID = dbo.Trial.CultureID LEFT OUTER JOIN
                         dbo.TrialCultureSteps_view_part1 ON dbo.Culture.cultureID = dbo.TrialCultureSteps_view_part1.cultureID

The other TrialCultureSteps_view_part1 view

SELECT DISTINCT dbo.Culture.cultureID,
                             (SELECT        TOP (1) WeekNr
                               FROM            dbo.CultureStep
                               WHERE        (CultureID = dbo.Culture.cultureID)
                               ORDER BY CultureStepID) AS normalstartweek
FROM            dbo.Culture INNER JOIN
                         dbo.CultureStep AS CultureStep_1 ON dbo.Culture.cultureID = CultureStep_1.CultureID

So how can I combine the joins the achieve the same results using SQL only on tables without the need for views?

Flowing Fount of Yak Knowledge

2780 Posts

Posted - 08/22/2014 :  10:45:52  Show Profile  Reply with Quote
duplicate of
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000