Hi,

Thanks for the reply, I've other fields in the price table and i'm
just showing a couple of fields here.

On Oct 18, 10:43 pm, Andrei Mita <[email protected]> wrote:
> First, make sure your db design is good. For instance, I don't think you
> need model_id in the price table as model is linked to price through
> variant. Actually, I don't see the use for the price table in your example.
> Why don't you just put another column in your variant table for price?
>
>
>
>
>
>
>
> On Mon, Oct 18, 2010 at 2:41 PM, mobz <[email protected]> wrote:
> > Hi guys!
>
> > I'm very new to cakephp and i'm working on my first cake project and i
> > would really appreciate if someone can point me in the right
> > direction!
>
> > the basic structure of my models:
>
> > model->variant->price
>
> > model (id, name)
> > variant (id, name, model_id)
> > price (id,price,model_id, variant_id)
>
> > i'm trying to create a car site
>
> > For example, there are 3 models and each model has a couple of
> > variants and each variant has its own price
>
> > models => BMW 3 Series, Audi A4, Golf GTi
>
> > variants => BMW 3 Series -> 2.0, 3.0, 4.0
> >                   Audi A4 -> 5.0, 6.0
> >                   Golf Gti -> 2.0, 4.0
>
> > prices => BMW 3 Series -> 2.0 -> 20000
> >                BMW 3 Series -> 3.0 -> 30000
> >                BMW 3 Series -> 4.0 -> 40000
> >                Audi A4 -> 5.0 -> 30000
> >                Audi A4 -> 6.0 -> 40000
> >                Golf Gti -> 2.0 -> 24000
> >                Golf GTi -> 4.0 -> 29000
>
> > my question is how can i calculate the max and min price of each
> > model? For example, on the model index page, i want to display the
> > price range of BMW 3 series, eg, BMW 3 Series ($20000 - $40000)?
>
> > I can do this in sql by selecting the MAX and MIN value of the prices,
> > joining the price and model tables and group by the model, so how can
> > i do this is cakephp?
>
> > thanks in advance
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups
> > "CakePHP" group.
> > To post to this group, send email to [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]<cake-php%[email protected]>For
> >  more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to