You are here: Re: Join 4 tables - can it be done? « MsSQL Server « IT news, forums, messages
Re: Join 4 tables - can it be done?

Posted by jefftyzzer on 01/31/08 02:41

On Jan 30, 3:07 pm, SirCodesALot <sjour...@gmail.com> wrote:
> I need some help, i need to join 4 tables but get a huge number of
> results, so I must be doing something wrong.
>
> here are my tables
>
> WebGroups
> - WebId
> -Title (values: "Admin" or "NonAdmin")
>
> WebGroupMembers
> - WebId
> - MemberId
>
> Webs
> - WebId
> - Title
>
> UserInfo
> -MemberId
> -Title
>
> I want to return the Distinct UserInfo.Title, Webs.Title,
> WebGroups.Title where WebGroups.Title="Admin"
>
> So here is what I thought should work
>
> Select Disctinct UserInfo.Title, Webs.Title, WebGroups.Title from
> Userinfo
> INNER JOIN WebGruopMembers
> ON UserInfo.MemberID = WebGroupMember.MemberID
> INNER JOIN WebGroups
> ON Webgroups.WebId = WebGroupMember.WebID
> INNER JOIN Webs
> ON WebGroups.WebId = WebGroups.WebID
> WHERE WebGroups.Title = "Admin"
>
> Any ideas?

Sir C:

Your joins look OK to me. Irrespective of quantity, do your results
look right? Are the returned rows indeed distinct, or are you saying
they're duplicated across your three columns? Lastly, is the only
value in title "Admin," as your query specifies?

Posting a snippet of your result set might go a long way to getting
some help.

Regards,

--Jeff

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация