SELECT Agent_Id, Name, LName, Email
FROM Agents
WHERE Agent_ID IN (Select * From Listings Where WHERE Listing.Id =
#url.id#)
----- Original Message -----
From: "Chris Giminez" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, April 30, 2000 8:56 PM
Subject: Re: tying two tables
> thanks for the reply, but that's not what I am trying to do. The only way
I can think to accomplish
> this is to use multiple - separate queries. If someone can show me how to
improve this, I'd
> appreciate it.
>
> Let me give you an example:
>
> Say I run a query for a real estate listing (this isn't what I'm doing,
but it correlates well)
>
> <CFQUERY NAME="property_detail" DATASOURCE="properties">
> SELECT *
> FROM Listing
> WHERE (Listing.Id = '#url.id#')
> </CFQUERY>
>
> Now, lets say this returns the address, city, zip, price, etc along with 5
ID's of agents that have
> shown this particular property. The format would be the agent's initials.
>
> Now I want to display the agent's full name and email on the same page.
>
> The table containing this might be something like:
>
> Agent_Id Name LName Email
> CSG Chris Giminez [EMAIL PROTECTED]
> ...and so on....
>
> I am accomplishing this by setting up additional queries for each "agent"
>
> <CFQUERY NAME="agent_name_1" DATASOURCE="properties">
> SELECT Agent_Id, Name, LName, Email
> FROM Agents
> WHERE (Agent_ID= '#property_detail.Agent_Id_1#')
> </CFQUERY>
>
> Then I run another query for each Agent_Id needed.
>
> I'm sure there's a better way, but I don't know what.
>
>
> Chris Giminez
> Owner - Cyber Scriber Web Site Design
> 831-728-4469
> ICQ# 2628000
>
>
>
>
> > On 4/30/00, Chris Giminez penned:
> > >Sorry if this is a lame question. I'm not very strong in SQL yet and
> > >am having a brain freeze on how
> > >to do this.
> > >
> > >I have table A where I pull one record. In this one record are name
> > >ID's that correspond to table B
> > >where the name ID's are associated with full name, email, phone, etc.
> > >
> > >How do I post information of each name id from table A as the full
> > >name, email, phone, etc from
> > >table B
> >
> > <CFQUERY DATASOURCE="mydatasource" NAME="myQuery">
> > SELECT Name,Address,City,State,Etc
> > FROM Table_A,Table_B
> > WHERE Table_A.NameID = Table_B.NameID AND
> > Some_Record_From_Table_A = '#Some_Search_Criteria#'
> > </CFQUERY>
> >
> > Name, Address, City and State are from table b. You could also
> > include any records you like from table a. The only time you'll need
> > to specify the table (like in Table_A.NameID) is if there are fields
> > named the same in both tables. It's also very important NOT to name
> > fields the same in two tables that may be called from the same query
> > unless they ARE related and contain the same info.
> >
> > Then:
> >
> > <cfoutput query = "myQuery">
> > #Name#<br>
> > #Address#<br>
> > #City#<br>
> > #State#<P>
> > </cfoutput>
> >
> >
> > Bud Schneehagen - Tropical Web Creations
> >
> > _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
> > ColdFusion Solutions / eCommerce Development
> > [EMAIL PROTECTED]
> > http://www.twcreations.com/
> > 954.721.3452
>
> --------------------------------------------------------------------------
----
> > Archives: http://www.eGroups.com/list/cf-talk
> > To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
> send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
> >
>
> --------------------------------------------------------------------------
----
> Archives: http://www.eGroups.com/list/cf-talk
> To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.