If I am understanding, all you need is one join from the DL_files table, if
more information. Note, I have not tested this, but at least it should give
groups by AssetID, then join to this view instead of the table. Basically
"enrique" <enrique@discussions.microsoft.com> wrote in message
news:C8BE2D07-6418-48E3-B7DF-56EE1990AAC3@microsoft.com...
>
> I would like this...
> assetID unitNumber fileTypeID
> --------------------------------------------------------
> 1 EXH0000001 5
> 1 EXH0000001 3
> 1 EXH0000001 4
> 1 EXH0000001 1
> 1 EXH0000001 6
> 1 EXH0000001 8
> 1 EXH0000001 6
> 1 EXH0000001 6
> 465 EXH0000465 8
> 465 EXH0000465 4
> 466 ASN0000466
> 467 EXH0000467 8
> 467 EXH0000467 1
> 468 ASN0000468
> 469 EXH0000469
> 470 EXH0000470 6
> 470 EXH0000470 8
> 471 ASN0000471 8
> 472 EXH0000472
> 473 EXH0000473
> 474 EXH0000474 1
> 475 EXH0000475
> 476 EXH0000476
> 477 EXH0000477
> 478 ASN0000478
> 479 ASN0000479
> 480 EXH0000480
>
> To look like this:
> assetID unitNumber fileTypeID
> --------------------------------------------------------
> 1 EXH0000001 5
> 465 EXH0000465 8
> 466 ASN0000466
> 467 EXH0000467 8
> 468 ASN0000468
> 469 EXH0000469
> 470 EXH0000470 8
> 471 ASN0000471 8
> 472 EXH0000472
> 473 EXH0000473
> 474 EXH0000474 1
> 475 EXH0000475
> 476 EXH0000476
> 477 EXH0000477
> 478 ASN0000478
> 479 ASN0000479
> 480 EXH0000480
>
>
> I think I know why I'm causing confusion...
>
> I may be approaching this wrong.
>
> Here is my scenario:
> I have a Search that needs to query the "assets" table along with the
> related tables, categories, files, etc (via the joins). So in essence my
> query is exactly where it needs to be I simply need a way to find a way of
> hiding the duplicates when I display the results. My app is
asp.net/vb.net.
>
> So my first guess to solve this is to handle this from the app side
instead
> of sql or is there a way to query (during search) and then display the
> returned records ignoring the duplicate primary ID's.
>
> Again, I must apologize for my newbie help request.
>
> "Jim Underwood" wrote:
>
> > I am still unsure as to what you are trying to get in your result set.
The
> > original result set for assetID = 1 is:
> >
> > assetID unitNumber fileTypeID
> > 1 EXH0000001 5
> > 1 EXH0000001 2
> > 1 EXH0000001 4
> > 1 EXH0000001 1
> > 1 EXH0000001 6
> > 1 EXH0000001 8
> > 1 EXH0000001 6
> > 1 EXH0000001 6
> >
> > Now I assume you are trying to get results that look line one fo the
> > following? If so, let us know which one you want to see in your
results, or
> > give us an example if none of these are correct.
> >
> > assetID unitNumber fileTypeID
> > 1 EXH0000001 5
> > 1 EXH0000001 2
> > 1 EXH0000001 4
> > 1 EXH0000001 1
> > 1 EXH0000001 6
> > 1 EXH0000001 8
> >
> > assetID unitNumber fileTypeID
> > 1 EXH0000001 5
> > 2
> > 4
> > 1
> > 6
> > 8
> >
> > assetID unitNumber fileTypeID
> > 1 EXH0000001 5
> >
> > "enrique" <enrique@discussions.microsoft.com> wrote in message
> > news:AA6105CE-D459-460D-BFC9-C21A1E780FE6@microsoft.com...
> > > My apologies if i wasn't too clear, it was late and I was trying to
> > simplify
> > > my question. :)
> > >
> > > Anyhow here's a link for the ddl:
> > >
http://www.hrm3.com/example/ddl.txt > > >
> > > And the actual script:
> > > SELECT DL_assets.assetID,
> > > DL_assets.unitNumber,
> > > DL_files.fileTypeID
> > > FROM DL_assets LEFT OUTER JOIN
> > > DL_files ON DL_assets.assetID = DL_files.assetID
> > >
> > > And here's a screen shot of my script and results:
> > >
http://www.hrm3.com/example/script.jpg > > >
> > > I understand that my query is returning, correctly, what I've scripted
but
> > > what I am looking for is a modification that would dislpay one 1
instance
> > of
> > > the assetID.
> > > I'll eventually be joining a few more tables but I wanted to resolve
my
> > > duplicates first.
> > >
> > > Problem:
> > > Displaying the duplicates of the "assetID" (primary key) column
> > >
> > > Solution:
> > > Hide/Ignore duplicates of the "assetID" column in the DL_assets table
> > >
> > > Let me know if you need more details.
> > >
> > > Thanks for the help!
> > > Henry
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > "Jim Underwood" wrote:
> > >
> > > > I am curious as to what you are trying to do here. t2.name has
multiple
> > > > values for each t2.nameid, so you will always get back more than one
> > row.
> > > > You can't do a distinct, because the values are not distinct. You
don't
> > > > actually have duplicates, just different rows with the same high
level
> > key
> > > > (meaning part of the key). Exactly what results do you want to get
from
> > > > this query?
> > > >
> > > > If you post an example of your data (6 rows from each table) and
show
> > what
> > > > you want the results to look like, we may be able to help. As it
is, we
> > can
> > > > only guess at what you are trying to accomplish and probably won't
be
> > able
> > > > to provide any useful information.
> > > >
> > > > Your query is specifically returning rows showing the discrepencies
> > between
> > > > values in the name field based on the NameID field. Without knowing
> > what
> > > > you are trying to accomplish, this query looks right.
> > > >
> > > >
> > > > "enrique" <enrique@discussions.microsoft.com> wrote in message
> > > > news:5A3ECCAE-B73C-4E16-AE26-78958EDB643F@microsoft.com...
> > > > > Hi,
> > > > >
> > > > > I'm trying to SELECT from two tables with a LEFT OUTER JOIN but I
> > can't
> > > > seem
> > > > > to figure out how to return the query without the duplicates.
> > > > > I know DISTICT works when querying one table but how do I ignore
> > > > duplicates,
> > > > > specifically in the primary key (ID) from joined tables?
> > > > >
> > > > > Here is my basic query:
> > > > >
> > > > > SELECT t1.nameID,