Re: SQL Statement

From: John Smith (notmyreal_at_address.com)
Date: 05/11/04


Date: Tue, 11 May 2004 13:43:45 -0400

I figured out my problem. I used the IN Clause to accomplish this. Here is
a sample for those of you wanting to know how.

SELECT tTable1.Field1, tTable1.Field2, (SELECT tTable2.Field2 FROM tTable2
IN 'C:\mydatabaselocation.mdb' WHERE tTable2.Field1=tTable1.Field1;) AS
MyDataFromTable2
FROM tTable1;

Thanx.

"John Smith" <notmyreal@address.com> wrote in message
news:OdQIwp5KEHA.2100@TK2MSFTNGP10.phx.gbl...
> Thanx a lot for all the help. It works perfectly.
>
> Okay, so let me ask you one more question now (last question, I promise
> ;) ). Can I connect to another database through the derived table method
> using SQL for Access 2000? If so, how would I go about adding a new db
> connection string into the SQL Statement? Both databases are in Access
> 2000.
>
> SELECT TableOne.Field1, (SELECT TableTwo.Field2 FROM TableTwo WHERE
> TableTwo.Field1 = TableOne.Field1) AS FieldDescription FROM TableOne
> WHERE....
>
>
> "Miha Markic [MVP C#]" <miha at rthand com> wrote in message
> news:OQyaIq2KEHA.3472@TK2MSFTNGP09.phx.gbl...
> > Hi John,
> >
> > Yes, of course it is possible.
> > Use normal brackets () instead of square ones and make sure that select
> > returns only one record.
> > But I guess it really depends on database if it supports the notation
> > (Access 2003, Sql server 2000 and Oracle 9ir2 do).
> > --
> > Miha Markic [MVP C#] - RightHand .NET consulting & software development
> > miha at rthand com
> > www.rthand.com
> >
> > "John Smith" <notmyreal@address.com> wrote in message
> > news:%231bXOETKEHA.268@TK2MSFTNGP11.phx.gbl...
> > > I am currently using Access, but if I migrated to another db I would
> like
> > to
> > > be able to easily take my queries with me in one big sql statement if
> > > possible. I do know about the SQL View within Access, but I was
> wondering
> > > for future use and for knowledge if it is possible to have queries
> within
> > > queries, but only using the sql statement of the queries.
> > >
> > > Maybe something like : Select tblOne.ID, [Select
> Count(tblTwo.SecondaryID)
> > > FROM tblTwo WHERE tblTwo.SecondaryID = tblOne.ID], [Select
> > > Count(tblTwo.AnotherID) FROM tblTwo WHERE tblTwo.SecondaryID =
> tblOne.ID]
> > > From tblOne.ID
> > >
> > > I have no idea how to do this or if it is even possible or if the
above
> is
> > > even correct, so I thought that I would check here. I apologize for
not
> > > using the ADO.NET newgroups and I thank you for the responses I have
> > already
> > > received. If anybody could just give me some examples or some hints
or
> > > websites to check out I would definitely appreciate the help.
> > >
> > > Thanx a lot for your help.
> > >
> > >
> > > "Miha Markic [MVP C#]" <miha at rthand com> wrote in message
> > > news:OVbeHgRKEHA.2556@TK2MSFTNGP11.phx.gbl...
> > > > Hi John,
> > > >
> > > > What database are you talking about?
> > > >
> > > > --
> > > > Miha Markic [MVP C#] - RightHand .NET consulting & software
> development
> > > > miha at rthand com
> > > > www.rthand.com
> > > >
> > > > "John Smith" <notmyreal@address.com> wrote in message
> > > > news:uu%23EQILKEHA.2688@TK2MSFTNGP10.phx.gbl...
> > > > > Can you do a Select Statement within a Select Statement? I want
to
> > > build
> > > > a
> > > > > query similar to queries built in Access which link to other
queries
> > but
> > > > > using only SQL Statements. Is it possible? If so, how do you do
> it?
> > > > >
> > > > > Thanx in adv.
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Relevant Pages