Reply to SQL Query help

Your name:

Reply:


Posted by MVM on 10/05/06 13:49

Hi,
I am attempting to run a query in MS SQL server between two tables that have
a one to many relationship.
The tables are linked on GID. What I want is one instance of every record
from Table 1 even if there isn't a record in Table 2; and even if there are
multiple records in Table 2.

Table 1:
GID
Parcel
Name
Address

Table 2:
GID
Acres


I tried a left outer join, but it still returns multiple results because
there are multiple records for the same GID in table 2.

SELECT a.GID, a.Parcel, a.Name, b.Acres from
Table1 a LEFT OUTER JOIN Table2 b
ON a.GID = b.GID


I also tried using the DISTINCT keyword, but the problem is that the Acres
are different for every record in Table 2.

What query can I run to achieve my desired result?

Thanks a bunch,
MVM

[Back to original 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

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