See complaint elsewhere as a result of cross-posting. Add my criticism because I'm on
both lists and keep them
in separate InBox folders and now feeling schizoid...
SELECT * [whatever]
FROM pristabell P, varetabell V1, varetabell V2
WHERE P.varenr = V1.varenr AND P.varenr = V2.varenr
AND V2.type = concat(V1.type, " meny")
[sorry, machine is busy on something, so haven't prototyped it]
The last AND condition might have to move to a HAVING clause.
This conditional on the larger product always being called name + " meny" - absolutely
NOT a good idea!
AND V2.pris > V1.pris
(better than what I said before)
Have you tried any of these?
> Pricetable: (varetabell)
> (varenr, type, pris)
> (1, '6inch', 29),
> (1, '6inch meny', 51),
> (1, 'footlong', 45),
> (1, 'footlong meny', 66),
> (1, 'salat', 39),
> (1, 'salat meny', 51),
> (2, '6inch', 49),
> (2, '6inch meny', 69),
> (2, 'footlong', 75),
> (2, 'footlong meny', 96),
> (2, 'salat', 49),
> (2, 'salat meny', 69),
> Product table: (pristabell)
> (varenr, varenavn, innhold)
> ('1','Veggie Delite','Grønnsaker og ost'),
> ('2','Subway Club', 'Kalkun, skinke og roasbeef'),
> ('3','Classic Italian BMT', 'Skinke, salami og pepperoni'),
> And the query that I have tried looks like this:
> SELECT varetabell.varenavn, varetabell.varenr, varetabell.innhold,
> pristabell.pris FROM varetabell, pristabell WHERE
> pristabell.varenr=varetabell.varenr AND pristabell.type='6inch' AND
> ----- Original Message -----
> From: "Rick Emery" <[EMAIL PROTECTED]>
> To: "'Raymond Lilleodegard'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Wednesday, February 06, 2002 6:23 PM
> Subject: RE: [PHP-DB] Is this possible?
> > Yes, you can do that easily.
> > It is easier to answer your question if you show us your table structure.
> > -----Original Message-----
> > From: Raymond Lilleodegard [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, February 06, 2002 11:16 AM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP-DB] 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
> > 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 Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php