Or, you could do it this way:

SELECT Lenders.LenderID, Lenders.LenderName,
Locations.LocationID, Locations.LocationName,
Contacts.ContactID, Contacts.ContactName
FROM Lenders, Locations, Contacts
WHERE Lenders.LenderID = Locations.LenderID
AND Locations.LocationID = Contacts.LocationID
FOR XML AUTO


--- In [email protected], "lostinrecursion" <[EMAIL PROTECTED]> wrote:
>
> Thanks for the hint. Could you possibly just give me a simple example
> of a FOR XML AUTO Query?
>
> --- In [email protected], "Tracy Spratt" tspratt@ wrote:
> >
> > Sure, that just looks like a couple joins. I don't do enough SQL to
> > spit out any code but that requirement wouldn't worry me.
> >
> >
> >
> > A hierarchy like you describe is most easily represented in XML. What I
> > do is build the query using FOR XML AUTO. Then I just pass that
> > resulting xml back to the Flex client.
> >
> >
> >
> > Tracy
> >
> >
> >
> > ________________________________
> >
> > From: [email protected] [mailto:[EMAIL PROTECTED] On
> > Behalf Of lostinrecursion
> > Sent: Friday, September 15, 2006 1:40 PM
> > To: [email protected]
> > Subject: [flexcoders] SQL Query to populate Flex Object (CF Backend)
> >
> >
> >
> > Hi all,
> >
> > The destination is Flex and although my question is a little Backend
> > oriented, I assume that many developers have faced this.
> >
> > I have a VO in my application called Lenders.
> >
> > Each Lender has x number of Locations (a collection of VOs represented
> > by an ArrayCollection called lender.locations)
> >
> > Each Location has x number of Contacts (another collection of VOs
> > represented by an ArrayCollection called
> > lender.selectedLocation.contacts)
> >
> > Anyway, the question is simple. I have 3 tables in a SQL Server 2005
> > DB which I use Coldfusion to query.
> >
> > The database tables (which are related by FK ids) will populate the
> > object.
> >
> > is there anyway for the SQL Query to do that work? Meaning a hierarchy?
> >
> > I would want it to return like this.
> >
> > Lender
> > Location
> > Contact
> > Contact
> > Location
> > Contact
> > Location
> >
> > You get the idea.
> >
> > is that possible or do I have to loop over the Queries in Coldfusion
> > and build them into structs?
> >
> > Thanks.
> >
>

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to