Re: Datagrid hide identical columns from a JOIN

From: Earl (brikshoe_at_newsgroups.nospam)
Date: 06/17/04


Date: Thu, 17 Jun 2004 15:35:11 -0500


>From previous experience (maybe on Access), I was under the impression I
couldn't JOIN on table.columns I didn't Select. I'll have to jump in and try
that on SQL2k.

"gh0st54" <gh0st54@hotmail.com> wrote in message
news:7fa3be06.0406171210.1694fa15@posting.google.com...
> Hi
>
> Why don't you write your query to return only the fields that you need
> ?
>
> let's say you have SalesId in sales table and SalesId in salesdetails
> table
> you will join on salesid but only want the id to be displayed once.
>
> the query would be :
> select sales.[salesid],salesdetails.[column_name] from sales inner
> join salesdetails on sales.salesid = salesdetails.salesid
>
> I hope that this is what you are looking for, this way the query is
> faster (retrieves only the data that you need) and you don't have
> redundant data.
>
> gh0st54
>
> "Earl" <brikshoe@newsgroups.nospam> wrote in message
news:<#KC1PfDVEHA.3428@TK2MSFTNGP12.phx.gbl>...
> > I do not normally use JOINS in my queries these days, but I have some
> > instances where I am simply showing historical data in a grid, and it is
> > thus much more convenient to JOIN everything I need in one stored
procedure.
> > Thus I might end up with data from 3, 4 or more tables -- some with
> > identical names (the JOIN criteria).
> >
> > I know how to hide columns in a straightforward query, but how about in
a
> > JOIN query where you may have 2 or even 3 or more identical field names
(IDs
> > usually)? How do you hide, for example, the SalesID from the 2nd table
or
> > the from the 3rd table? For example, the following statement works for
the
> > first SalesID, but what about the other JOINED SalesID fields? (I've
tried
> > "SalesID1" and "Expr1", but no joy except SalesID1 seems to work on a
simple
> > query with 2 joined tables).
> >
> > ds.Tables("dtSalesPayments").Columns("SalesID").ColumnMapping =
> > MappingType.Hidden



Relevant Pages

  • Re: Datagrid hide identical columns from a JOIN
    ... There are a couple of other issues with not retrieving your primary ... > Why don't you write your query to return only the fields that you need ... > let's say you have SalesId in sales table and SalesId in salesdetails ... > join salesdetails on sales.salesid = salesdetails.salesid ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Datagrid hide identical columns from a JOIN
    ... There are a couple of other issues with not retrieving your primary ... > Why don't you write your query to return only the fields that you need ... > let's say you have SalesId in sales table and SalesId in salesdetails ... > join salesdetails on sales.salesid = salesdetails.salesid ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • Re: Datagrid hide identical columns from a JOIN
    ... Why don't you write your query to return only the fields that you need ... let's say you have SalesId in sales table and SalesId in salesdetails ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Datagrid hide identical columns from a JOIN
    ... Why don't you write your query to return only the fields that you need ... let's say you have SalesId in sales table and SalesId in salesdetails ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • Re: Datagrid hide identical columns from a JOIN
    ... I'll have to jump in and try ... > Why don't you write your query to return only the fields that you need ... > let's say you have SalesId in sales table and SalesId in salesdetails ... > join salesdetails on sales.salesid = salesdetails.salesid ...
    (microsoft.public.dotnet.framework.adonet)

Loading