Re: Is this possible?

From: Date: Wed, 06 Feb 2002 18:20:03 +0000
Subject: Re: Is this possible?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-83736@lists.php.net to get a copy of this message
val, Surely this would only be possible if "SIZE1" and "P2" [sic - maybe "SIZE2"] were constants, ie that all small packs had SIZE="small" and all large packs were defined as SIZE="large". (also that all products had no more than two sizes) Interesting thought though (subject to the <=2 sizes constraint), could there be a LEFT JOIN off PRODUCTS, but put P1 and P2 into a cartesian product but only selecting where there is inequality: WHERE P.NUM=P1.ID AND P.NUM=P2.ID AND P1.SIZE <> P2.SIZE [sorry, machine is busy on something, so haven't prototyped it] Raymond: is there a SIZE (type of) field? Do the above constraints apply? What are the table definitions you are using? Any chance of some sample data? Please advise, =dn > Let prices(id,price etc.) be table of prices, products(NUM,name etc). > > Try smth like this: > > SELECT DISTINCT * FROM PRODUCTS P, PRICES P1, PRICES P2 > WHERE P.NUM=P1.ID AND P.NUM=P2.ID AND P1.SIZE=SIZE1 AND P2.SIZE=P2 > > > Valentin Petruchek (aki Zliy Pes) > http://zliypes.com.ua > mailto:val@zliypes.com.ua > ----- Original Message ----- > From: "Raymond Lilleodegard" <> > To: <php-general@lists.php.net> > Sent: Wednesday, February 06, 2002 7:16 PM > Subject: [PHP] Is this possible? > > > > Hi! > > > > I have this tricky case, at lest for me : ) > > > > I'm trying to get some data out of two tables and listing the data in a > > product/price site. But..... : > > > > I have one table with productinfo and one with prices. > > And it is several columns with the same id in the pricetable, because > every > > product have several sizes. > > > > So... how do I get only one row from the "product table" and two rows from > > the "price table" in one line in a page? > > Is it possible? > > > > > > > > Best regards > > > > Raymond > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.general (#83736) next »