Jump to content

multiple queries into one query


sweeny500

Recommended Posts

Hi All

 

I think I have a performance problem with my queries.

I have two tables.

 

Agents and Properties

 

In the result I need to get each agents full details (in a certain county) and then the full details of each  property for every

 

agent returned.

 

At the moment I query the agents table and while looping through these I query the properties table for each agent. I think

 

there must be a quicker way using joins or subqueries but I can't work it out. Any Help much appreciated

 

 

Table Agents....

 

Agent ID, Agent Name, Agent Address, AgentCounty

 

 

Table Properties.

 

Agent ID, PropertyAddress, Bedrooms, Bathrooms, PropertyType

 

 

 

 

 

PS. I will be using the results to populate an xml file something like this...

 

 

 
<properties>
     <entry>
         <agents name="John Smith"  address="20 Bridge Street" county="Tilby"/>
           <prop>
                <address>25 Sea View</address>
                <bedrooms>5</bedrooms>
                <bathrooms>3</bathrooms>
                <propertytype>Duplex</propertytype>
           </prop>
     </entry>     
</properties>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.