> > Right, I'm not gonna address the whole thing (no time at the
> moment), but
> a
> > quick word about sub-queries
> >
> > They should be used in 2 ways - one to return a single result;
> > select * from myTable where myValue=(select myValue from myOtherTable
> > where...)
> >
> > Or to return multiple values
> > select * from myTable where myValue in (select myValue from myOtherTable
> > where...)
> >
> > The second is a lot more useful for what you're looking for
>
> Right, but I don't see how that helps me.  Neither of those two uses of
> subqueries returns a LIST of values that can be used in a single field of
> the parent query.
>
> For example, if my mapping table looks like so:
> ItemID        CategoryID
> ----------------------------------
> 1                1
> 1                2
> 1                4
> 2                2
> 2                4
>
> I would like the details query for ItemID 1 to have the following fields:
> .Name - simply pulled from item table
> .Desc - simply pulled from item table
> .CategoryIDs - "1,2,4"
>
> I've looked through a couple of my SQL books and haven't found an
> answer, so
> maybe this isn't possible (using SQL 6.5, BTW).  Its not THAT big
> of a deal to run two queries.

I must have mis-understood what you wanted - I had assumed that you wanted
all select all categoried that were related to one product category - it'd
probably be easier to run 2 queries (from what I see you want - again, I
could be mis-understanding)

BTW a sub query effectively makes a comma separated list if it returns more
than one record, so the IN would work rather than the =

Philip Arnold
ASP Multimedia Limited
T: +44 (0)20 8680 1133

"Websites for the real world"

**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
**********************************************************************


------------------------------------------------------------------------------
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.

Reply via email to