Re: Two things I have not seen support for in Cake (group by and inner join)

2008-02-23 Thread nate

Gimmie a couple days, I'll fix it.

A test case or something would be nice though. ;-)

On Feb 22, 6:47 pm, rtconner <[EMAIL PROTECTED]> wrote:
> ya, but if that type option is supposed to work
>
> .. blah ... should continue this in trac?https://trac.cakephp.org/ticket/4085
>
> On Feb 22, 3:51 pm, Baz <[EMAIL PROTECTED]> wrote:
>
> > Didn't I just post an alternative?
>
> > On Fri, Feb 22, 2008 at 2:33 PM, rtconner <[EMAIL PROTECTED]> wrote:
>
> > > I can't get array('type' => 'INNER') to work wither.
>
> > > On Feb 22, 12:26 pm, Baz <[EMAIL PROTECTED]> wrote:
> > > > Maybe the core developers can reveal this mystery about type => 'INNER'
>
> > > > I haven't seen this documented any where.
>
> > > > And as you can see in the first link sent, I didn't work for me...and
> > > > there's no response. What did work, is a pseudoINNERjoin, which get's
> > > the
> > > > job done:
>
> > > >http://groups.google.com/group/cake-php/browse_thread/thread/77cc0617...
> > > > (funny, there are like 6 more responses to this that I can see in my
> > > email,
> > > > but not in the group)
>
> > > > Basically, you do a dummy hasOne bind and in your find do a condition:
> > > > "Where Dummy.id IS NOT NULL"...
>
> > > > On Fri, Feb 22, 2008 at 12:37 PM, rtconner <[EMAIL PROTECTED]> wrote:
>
> > > > > Re: GROUP BY,
> > > > > Yeah.. sometimes with group by you have to prepend DISTINCT to the
> > > > > primary key to prevent duplicates. I can try to find a query example
> > > > > if you really have never come across this. It's pretty common. I have
> > > > > some hacks to do this, but if cake really supported grouping, I would
> > > > > not be hacking anything.
>
> > > > > Also,
> > > > > I saw thatINNERJOINin the translation behavior. I tried to play
> > > > > with that, but never got anything to work. That code is not a
> > > > > relationship definition (as nate revealed will work in that posting)
> > > > > but it is a query in array format. Normal cake usage does not have any
> > > > > place where you build things like that.
>
> > > > > Anyways...
> > > > > Really thanks for the links. Very helpful to know.
>
> > > > > On Feb 22, 9:17 am, "[EMAIL PROTECTED]"
> > > > > <[EMAIL PROTECTED]> wrote:
> > > > > > Re:INNER
>
> > >JOINhttp://groups.google.com/group/cake-php/browse_thread/thread/9f092441...
>
> > > > > > I believe the TranslateBehavior uses anINNERJOINif you're looking
> > > > > > for an example on how to dynamically change the binding although I
> > > > > > haven't actually used this myself yet
> > > > > .http://api.cakephp.org/1.2/translate_8php-source.html#l00070
>
> > > > > > For GROUP BY I believe the norm is to use the conditions to pass in
> > > > > > your group by clause
>
> > > .https://trac.cakephp.org/browser/branches/1.2.x.x/cake/tests/cases/li...
>
> > > > > > When has this not proved sufficient? Do you have a specific example?
>
> > > > > > On Feb 21, 6:51 pm, rtconner <[EMAIL PROTECTED]> wrote:
>
> > > > > > > I have no found a good way to do GROUP BY queries orINNERJOIN's
> > > in
> > > > > > > cake.
> > > > > > > Was wondering if any of you have come across these and how you
> > > handled
> > > > > > > them. I have not been able to do either of them in conjunction
> > > with
> > > > > > > the find() method in any normal way.Perhaps I am missing
> > > something?
> > > > > > > I'd love to find out if I am. Are these some sort of database
> > > specific
> > > > > > > constructs?
>
> > > > > > > With Group by, sometimes I can get away with appending
> > > $conditions[] =
> > > > > > > 'GROUP BY field'; annd the in addition to that, manually passing
> > > in
> > > > > > > the fields to find() and prepending DISTINCT to the id column.
>
> > > > > > >InnerJoinI have seen zero support from in Cake. Any time I've
> > > wanted
> > > > > > > toInnerjoinI've had to write the query manually. You know,
> > > > > > > sometimes you just need to filter your queries based on two
> > > tables,
> > > > > > > not just your primary table.
>
> > > > > > > Any help on these issues would be greatly appreaciated. I know I
> > > am
> > > > > > > not the only one who has had trouble with them.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Two things I have not seen support for in Cake (group by and inner join)

2008-02-22 Thread Baz
Huh, I even forgot that I made a trac for it.

What do you mean continue it? I guess they'll get to it when they get to it.

On Fri, Feb 22, 2008 at 5:47 PM, rtconner <[EMAIL PROTECTED]> wrote:

>
> ya, but if that type option is supposed to work
>
> .. blah ... should continue this in trac?
> https://trac.cakephp.org/ticket/4085
>
> On Feb 22, 3:51 pm, Baz <[EMAIL PROTECTED]> wrote:
> > Didn't I just post an alternative?
> >
> > On Fri, Feb 22, 2008 at 2:33 PM, rtconner <[EMAIL PROTECTED]> wrote:
> >
> > > I can't get array('type' => 'INNER') to work wither.
> >
> > > On Feb 22, 12:26 pm, Baz <[EMAIL PROTECTED]> wrote:
> > > > Maybe the core developers can reveal this mystery about type =>
> 'INNER'
> >
> > > > I haven't seen this documented any where.
> >
> > > > And as you can see in the first link sent, I didn't work for
> me...and
> > > > there's no response. What did work, is a pseudo INNER join, which
> get's
> > > the
> > > > job done:
> >
> > > >
> http://groups.google.com/group/cake-php/browse_thread/thread/77cc0617...
> > > > (funny, there are like 6 more responses to this that I can see in my
> > > email,
> > > > but not in the group)
> >
> > > > Basically, you do a dummy hasOne bind and in your find do a
> condition:
> > > > "Where Dummy.id IS NOT NULL"...
> >
> > > > On Fri, Feb 22, 2008 at 12:37 PM, rtconner <[EMAIL PROTECTED]>
> wrote:
> >
> > > > > Re: GROUP BY,
> > > > > Yeah.. sometimes with group by you have to prepend DISTINCT to the
> > > > > primary key to prevent duplicates. I can try to find a query
> example
> > > > > if you really have never come across this. It's pretty common. I
> have
> > > > > some hacks to do this, but if cake really supported grouping, I
> would
> > > > > not be hacking anything.
> >
> > > > > Also,
> > > > > I saw that INNER JOIN in the translation behavior. I tried to play
> > > > > with that, but never got anything to work. That code is not a
> > > > > relationship definition (as nate revealed will work in that
> posting)
> > > > > but it is a query in array format. Normal cake usage does not have
> any
> > > > > place where you build things like that.
> >
> > > > > Anyways...
> > > > > Really thanks for the links. Very helpful to know.
> >
> > > > > On Feb 22, 9:17 am, "[EMAIL PROTECTED]"
> > > > > <[EMAIL PROTECTED]> wrote:
> > > > > > Re: INNER
> >
> > >
> JOINhttp://groups.google.com/group/cake-php/browse_thread/thread/9f092441...
> >
> > > > > > I believe the TranslateBehavior uses an INNER JOIN if you're
> looking
> > > > > > for an example on how to dynamically change the binding although
> I
> > > > > > haven't actually used this myself yet
> > > > > .http://api.cakephp.org/1.2/translate_8php-source.html#l00070
> >
> > > > > > For GROUP BY I believe the norm is to use the conditions to pass
> in
> > > > > > your group by clause
> >
> > >
> .https://trac.cakephp.org/browser/branches/1.2.x.x/cake/tests/cases/li...
> >
> > > > > > When has this not proved sufficient? Do you have a specific
> example?
> >
> > > > > > On Feb 21, 6:51 pm, rtconner <[EMAIL PROTECTED]> wrote:
> >
> > > > > > > I have no found a good way to do GROUP BY queries or INNER
> JOIN's
> > > in
> > > > > > > cake.
> > > > > > > Was wondering if any of you have come across these and how you
> > > handled
> > > > > > > them. I have not been able to do either of them in conjunction
> > > with
> > > > > > > the find() method in any normal way.Perhaps I am missing
> > > something?
> > > > > > > I'd love to find out if I am. Are these some sort of database
> > > specific
> > > > > > > constructs?
> >
> > > > > > > With Group by, sometimes I can get away with appending
> > > $conditions[] =
> > > > > > > 'GROUP BY field'; annd the in addition to that, manually
> passing
> > > in
> > > > > > > the fields to find() and prepending DISTINCT to the id column.
> >
> > > > > > > Inner Join I have seen zero support from in Cake. Any time
> I've
> > > wanted
> > > > > > > to Inner join I've had to write the query manually. You know,
> > > > > > > sometimes you just need to filter your queries based on two
> > > tables,
> > > > > > > not just your primary table.
> >
> > > > > > > Any help on these issues would be greatly appreaciated. I know
> I
> > > am
> > > > > > > not the only one who has had trouble with them.
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Two things I have not seen support for in Cake (group by and inner join)

2008-02-22 Thread rtconner

ya, but if that type option is supposed to work

.. blah ... should continue this in trac?
https://trac.cakephp.org/ticket/4085

On Feb 22, 3:51 pm, Baz <[EMAIL PROTECTED]> wrote:
> Didn't I just post an alternative?
>
> On Fri, Feb 22, 2008 at 2:33 PM, rtconner <[EMAIL PROTECTED]> wrote:
>
> > I can't get array('type' => 'INNER') to work wither.
>
> > On Feb 22, 12:26 pm, Baz <[EMAIL PROTECTED]> wrote:
> > > Maybe the core developers can reveal this mystery about type => 'INNER'
>
> > > I haven't seen this documented any where.
>
> > > And as you can see in the first link sent, I didn't work for me...and
> > > there's no response. What did work, is a pseudo INNER join, which get's
> > the
> > > job done:
>
> > >http://groups.google.com/group/cake-php/browse_thread/thread/77cc0617...
> > > (funny, there are like 6 more responses to this that I can see in my
> > email,
> > > but not in the group)
>
> > > Basically, you do a dummy hasOne bind and in your find do a condition:
> > > "Where Dummy.id IS NOT NULL"...
>
> > > On Fri, Feb 22, 2008 at 12:37 PM, rtconner <[EMAIL PROTECTED]> wrote:
>
> > > > Re: GROUP BY,
> > > > Yeah.. sometimes with group by you have to prepend DISTINCT to the
> > > > primary key to prevent duplicates. I can try to find a query example
> > > > if you really have never come across this. It's pretty common. I have
> > > > some hacks to do this, but if cake really supported grouping, I would
> > > > not be hacking anything.
>
> > > > Also,
> > > > I saw that INNER JOIN in the translation behavior. I tried to play
> > > > with that, but never got anything to work. That code is not a
> > > > relationship definition (as nate revealed will work in that posting)
> > > > but it is a query in array format. Normal cake usage does not have any
> > > > place where you build things like that.
>
> > > > Anyways...
> > > > Really thanks for the links. Very helpful to know.
>
> > > > On Feb 22, 9:17 am, "[EMAIL PROTECTED]"
> > > > <[EMAIL PROTECTED]> wrote:
> > > > > Re: INNER
>
> > JOINhttp://groups.google.com/group/cake-php/browse_thread/thread/9f092441...
>
> > > > > I believe the TranslateBehavior uses an INNER JOIN if you're looking
> > > > > for an example on how to dynamically change the binding although I
> > > > > haven't actually used this myself yet
> > > > .http://api.cakephp.org/1.2/translate_8php-source.html#l00070
>
> > > > > For GROUP BY I believe the norm is to use the conditions to pass in
> > > > > your group by clause
>
> > .https://trac.cakephp.org/browser/branches/1.2.x.x/cake/tests/cases/li...
>
> > > > > When has this not proved sufficient? Do you have a specific example?
>
> > > > > On Feb 21, 6:51 pm, rtconner <[EMAIL PROTECTED]> wrote:
>
> > > > > > I have no found a good way to do GROUP BY queries or INNER JOIN's
> > in
> > > > > > cake.
> > > > > > Was wondering if any of you have come across these and how you
> > handled
> > > > > > them. I have not been able to do either of them in conjunction
> > with
> > > > > > the find() method in any normal way.Perhaps I am missing
> > something?
> > > > > > I'd love to find out if I am. Are these some sort of database
> > specific
> > > > > > constructs?
>
> > > > > > With Group by, sometimes I can get away with appending
> > $conditions[] =
> > > > > > 'GROUP BY field'; annd the in addition to that, manually passing
> > in
> > > > > > the fields to find() and prepending DISTINCT to the id column.
>
> > > > > > Inner Join I have seen zero support from in Cake. Any time I've
> > wanted
> > > > > > to Inner join I've had to write the query manually. You know,
> > > > > > sometimes you just need to filter your queries based on two
> > tables,
> > > > > > not just your primary table.
>
> > > > > > Any help on these issues would be greatly appreaciated. I know I
> > am
> > > > > > not the only one who has had trouble with them.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Two things I have not seen support for in Cake (group by and inner join)

2008-02-22 Thread Baz
Didn't I just post an alternative?

On Fri, Feb 22, 2008 at 2:33 PM, rtconner <[EMAIL PROTECTED]> wrote:

>
> I can't get array('type' => 'INNER') to work wither.
>
> On Feb 22, 12:26 pm, Baz <[EMAIL PROTECTED]> wrote:
> > Maybe the core developers can reveal this mystery about type => 'INNER'
> >
> > I haven't seen this documented any where.
> >
> > And as you can see in the first link sent, I didn't work for me...and
> > there's no response. What did work, is a pseudo INNER join, which get's
> the
> > job done:
> >
> > http://groups.google.com/group/cake-php/browse_thread/thread/77cc0617...
> > (funny, there are like 6 more responses to this that I can see in my
> email,
> > but not in the group)
> >
> > Basically, you do a dummy hasOne bind and in your find do a condition:
> > "Where Dummy.id IS NOT NULL"...
> >
> > On Fri, Feb 22, 2008 at 12:37 PM, rtconner <[EMAIL PROTECTED]> wrote:
> >
> > > Re: GROUP BY,
> > > Yeah.. sometimes with group by you have to prepend DISTINCT to the
> > > primary key to prevent duplicates. I can try to find a query example
> > > if you really have never come across this. It's pretty common. I have
> > > some hacks to do this, but if cake really supported grouping, I would
> > > not be hacking anything.
> >
> > > Also,
> > > I saw that INNER JOIN in the translation behavior. I tried to play
> > > with that, but never got anything to work. That code is not a
> > > relationship definition (as nate revealed will work in that posting)
> > > but it is a query in array format. Normal cake usage does not have any
> > > place where you build things like that.
> >
> > > Anyways...
> > > Really thanks for the links. Very helpful to know.
> >
> > > On Feb 22, 9:17 am, "[EMAIL PROTECTED]"
> > > <[EMAIL PROTECTED]> wrote:
> > > > Re: INNER
> > >
> JOINhttp://groups.google.com/group/cake-php/browse_thread/thread/9f092441...
> >
> > > > I believe the TranslateBehavior uses an INNER JOIN if you're looking
> > > > for an example on how to dynamically change the binding although I
> > > > haven't actually used this myself yet
> > > .http://api.cakephp.org/1.2/translate_8php-source.html#l00070
> >
> > > > For GROUP BY I believe the norm is to use the conditions to pass in
> > > > your group by clause
> > >
> .https://trac.cakephp.org/browser/branches/1.2.x.x/cake/tests/cases/li...
> >
> > > > When has this not proved sufficient? Do you have a specific example?
> >
> > > > On Feb 21, 6:51 pm, rtconner <[EMAIL PROTECTED]> wrote:
> >
> > > > > I have no found a good way to do GROUP BY queries or INNER JOIN's
> in
> > > > > cake.
> > > > > Was wondering if any of you have come across these and how you
> handled
> > > > > them. I have not been able to do either of them in conjunction
> with
> > > > > the find() method in any normal way.Perhaps I am missing
> something?
> > > > > I'd love to find out if I am. Are these some sort of database
> specific
> > > > > constructs?
> >
> > > > > With Group by, sometimes I can get away with appending
> $conditions[] =
> > > > > 'GROUP BY field'; annd the in addition to that, manually passing
> in
> > > > > the fields to find() and prepending DISTINCT to the id column.
> >
> > > > > Inner Join I have seen zero support from in Cake. Any time I've
> wanted
> > > > > to Inner join I've had to write the query manually. You know,
> > > > > sometimes you just need to filter your queries based on two
> tables,
> > > > > not just your primary table.
> >
> > > > > Any help on these issues would be greatly appreaciated. I know I
> am
> > > > > not the only one who has had trouble with them.
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Two things I have not seen support for in Cake (group by and inner join)

2008-02-22 Thread rtconner

I can't get array('type' => 'INNER') to work wither.

On Feb 22, 12:26 pm, Baz <[EMAIL PROTECTED]> wrote:
> Maybe the core developers can reveal this mystery about type => 'INNER'
>
> I haven't seen this documented any where.
>
> And as you can see in the first link sent, I didn't work for me...and
> there's no response. What did work, is a pseudo INNER join, which get's the
> job done:
>
> http://groups.google.com/group/cake-php/browse_thread/thread/77cc0617...
> (funny, there are like 6 more responses to this that I can see in my email,
> but not in the group)
>
> Basically, you do a dummy hasOne bind and in your find do a condition:
> "Where Dummy.id IS NOT NULL"...
>
> On Fri, Feb 22, 2008 at 12:37 PM, rtconner <[EMAIL PROTECTED]> wrote:
>
> > Re: GROUP BY,
> > Yeah.. sometimes with group by you have to prepend DISTINCT to the
> > primary key to prevent duplicates. I can try to find a query example
> > if you really have never come across this. It's pretty common. I have
> > some hacks to do this, but if cake really supported grouping, I would
> > not be hacking anything.
>
> > Also,
> > I saw that INNER JOIN in the translation behavior. I tried to play
> > with that, but never got anything to work. That code is not a
> > relationship definition (as nate revealed will work in that posting)
> > but it is a query in array format. Normal cake usage does not have any
> > place where you build things like that.
>
> > Anyways...
> > Really thanks for the links. Very helpful to know.
>
> > On Feb 22, 9:17 am, "[EMAIL PROTECTED]"
> > <[EMAIL PROTECTED]> wrote:
> > > Re: INNER
> > JOINhttp://groups.google.com/group/cake-php/browse_thread/thread/9f092441...
>
> > > I believe the TranslateBehavior uses an INNER JOIN if you're looking
> > > for an example on how to dynamically change the binding although I
> > > haven't actually used this myself yet
> > .http://api.cakephp.org/1.2/translate_8php-source.html#l00070
>
> > > For GROUP BY I believe the norm is to use the conditions to pass in
> > > your group by clause
> > .https://trac.cakephp.org/browser/branches/1.2.x.x/cake/tests/cases/li...
>
> > > When has this not proved sufficient? Do you have a specific example?
>
> > > On Feb 21, 6:51 pm, rtconner <[EMAIL PROTECTED]> wrote:
>
> > > > I have no found a good way to do GROUP BY queries or INNER JOIN's in
> > > > cake.
> > > > Was wondering if any of you have come across these and how you handled
> > > > them. I have not been able to do either of them in conjunction with
> > > > the find() method in any normal way.Perhaps I am missing something?
> > > > I'd love to find out if I am. Are these some sort of database specific
> > > > constructs?
>
> > > > With Group by, sometimes I can get away with appending $conditions[] =
> > > > 'GROUP BY field'; annd the in addition to that, manually passing in
> > > > the fields to find() and prepending DISTINCT to the id column.
>
> > > > Inner Join I have seen zero support from in Cake. Any time I've wanted
> > > > to Inner join I've had to write the query manually. You know,
> > > > sometimes you just need to filter your queries based on two tables,
> > > > not just your primary table.
>
> > > > Any help on these issues would be greatly appreaciated. I know I am
> > > > not the only one who has had trouble with them.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Two things I have not seen support for in Cake (group by and inner join)

2008-02-22 Thread Baz
Maybe the core developers can reveal this mystery about type => 'INNER'

I haven't seen this documented any where.

And as you can see in the first link sent, I didn't work for me...and
there's no response. What did work, is a pseudo INNER join, which get's the
job done:

http://groups.google.com/group/cake-php/browse_thread/thread/77cc061717aafd0b/145ec0f124b9b75b?lnk=gst&q=inner+join#145ec0f124b9b75b
(funny, there are like 6 more responses to this that I can see in my email,
but not in the group)

Basically, you do a dummy hasOne bind and in your find do a condition:
"Where Dummy.id IS NOT NULL"...

On Fri, Feb 22, 2008 at 12:37 PM, rtconner <[EMAIL PROTECTED]> wrote:

>
> Re: GROUP BY,
> Yeah.. sometimes with group by you have to prepend DISTINCT to the
> primary key to prevent duplicates. I can try to find a query example
> if you really have never come across this. It's pretty common. I have
> some hacks to do this, but if cake really supported grouping, I would
> not be hacking anything.
>
> Also,
> I saw that INNER JOIN in the translation behavior. I tried to play
> with that, but never got anything to work. That code is not a
> relationship definition (as nate revealed will work in that posting)
> but it is a query in array format. Normal cake usage does not have any
> place where you build things like that.
>
> Anyways...
> Really thanks for the links. Very helpful to know.
>
>
>
>
>
> On Feb 22, 9:17 am, "[EMAIL PROTECTED]"
> <[EMAIL PROTECTED]> wrote:
> > Re: INNER
> JOINhttp://groups.google.com/group/cake-php/browse_thread/thread/9f092441...
> >
> > I believe the TranslateBehavior uses an INNER JOIN if you're looking
> > for an example on how to dynamically change the binding although I
> > haven't actually used this myself yet
> .http://api.cakephp.org/1.2/translate_8php-source.html#l00070
> >
> > For GROUP BY I believe the norm is to use the conditions to pass in
> > your group by clause
> .https://trac.cakephp.org/browser/branches/1.2.x.x/cake/tests/cases/li...
> >
> > When has this not proved sufficient? Do you have a specific example?
> >
> > On Feb 21, 6:51 pm, rtconner <[EMAIL PROTECTED]> wrote:
> >
> > > I have no found a good way to do GROUP BY queries or INNER JOIN's in
> > > cake.
> > > Was wondering if any of you have come across these and how you handled
> > > them. I have not been able to do either of them in conjunction with
> > > the find() method in any normal way.Perhaps I am missing something?
> > > I'd love to find out if I am. Are these some sort of database specific
> > > constructs?
> >
> > > With Group by, sometimes I can get away with appending $conditions[] =
> > > 'GROUP BY field'; annd the in addition to that, manually passing in
> > > the fields to find() and prepending DISTINCT to the id column.
> >
> > > Inner Join I have seen zero support from in Cake. Any time I've wanted
> > > to Inner join I've had to write the query manually. You know,
> > > sometimes you just need to filter your queries based on two tables,
> > > not just your primary table.
> >
> > > Any help on these issues would be greatly appreaciated. I know I am
> > > not the only one who has had trouble with them.
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Two things I have not seen support for in Cake (group by and inner join)

2008-02-22 Thread rtconner

Re: GROUP BY,
Yeah.. sometimes with group by you have to prepend DISTINCT to the
primary key to prevent duplicates. I can try to find a query example
if you really have never come across this. It's pretty common. I have
some hacks to do this, but if cake really supported grouping, I would
not be hacking anything.

Also,
I saw that INNER JOIN in the translation behavior. I tried to play
with that, but never got anything to work. That code is not a
relationship definition (as nate revealed will work in that posting)
but it is a query in array format. Normal cake usage does not have any
place where you build things like that.

Anyways...
Really thanks for the links. Very helpful to know.





On Feb 22, 9:17 am, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> Re: INNER 
> JOINhttp://groups.google.com/group/cake-php/browse_thread/thread/9f092441...
>
> I believe the TranslateBehavior uses an INNER JOIN if you're looking
> for an example on how to dynamically change the binding although I
> haven't actually used this myself 
> yet.http://api.cakephp.org/1.2/translate_8php-source.html#l00070
>
> For GROUP BY I believe the norm is to use the conditions to pass in
> your group by 
> clause.https://trac.cakephp.org/browser/branches/1.2.x.x/cake/tests/cases/li...
>
> When has this not proved sufficient? Do you have a specific example?
>
> On Feb 21, 6:51 pm, rtconner <[EMAIL PROTECTED]> wrote:
>
> > I have no found a good way to do GROUP BY queries or INNER JOIN's in
> > cake.
> > Was wondering if any of you have come across these and how you handled
> > them. I have not been able to do either of them in conjunction with
> > the find() method in any normal way.Perhaps I am missing something?
> > I'd love to find out if I am. Are these some sort of database specific
> > constructs?
>
> > With Group by, sometimes I can get away with appending $conditions[] =
> > 'GROUP BY field'; annd the in addition to that, manually passing in
> > the fields to find() and prepending DISTINCT to the id column.
>
> > Inner Join I have seen zero support from in Cake. Any time I've wanted
> > to Inner join I've had to write the query manually. You know,
> > sometimes you just need to filter your queries based on two tables,
> > not just your primary table.
>
> > Any help on these issues would be greatly appreaciated. I know I am
> > not the only one who has had trouble with them.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Two things I have not seen support for in Cake (group by and inner join)

2008-02-22 Thread [EMAIL PROTECTED]

Re: INNER JOIN
http://groups.google.com/group/cake-php/browse_thread/thread/9f092441185a5b72/f32a7b86bc9ec5d1

I believe the TranslateBehavior uses an INNER JOIN if you're looking
for an example on how to dynamically change the binding although I
haven't actually used this myself yet.
http://api.cakephp.org/1.2/translate_8php-source.html#l00070

For GROUP BY I believe the norm is to use the conditions to pass in
your group by clause.
https://trac.cakephp.org/browser/branches/1.2.x.x/cake/tests/cases/libs/model/datasources/dbo_source.test.php#L1354

When has this not proved sufficient? Do you have a specific example?

On Feb 21, 6:51 pm, rtconner <[EMAIL PROTECTED]> wrote:
> I have no found a good way to do GROUP BY queries or INNER JOIN's in
> cake.
> Was wondering if any of you have come across these and how you handled
> them. I have not been able to do either of them in conjunction with
> the find() method in any normal way.Perhaps I am missing something?
> I'd love to find out if I am. Are these some sort of database specific
> constructs?
>
> With Group by, sometimes I can get away with appending $conditions[] =
> 'GROUP BY field'; annd the in addition to that, manually passing in
> the fields to find() and prepending DISTINCT to the id column.
>
> Inner Join I have seen zero support from in Cake. Any time I've wanted
> to Inner join I've had to write the query manually. You know,
> sometimes you just need to filter your queries based on two tables,
> not just your primary table.
>
> Any help on these issues would be greatly appreaciated. I know I am
> not the only one who has had trouble with them.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Two things I have not seen support for in Cake (group by and inner join)

2008-02-21 Thread chad

I've also had to do this before. I resort back to findAll for GROUP
BY. I would just do a "1=1 GROUP BY...". Today i've run into a similar
problem by having to use a HAVING and GROUP_CONCAT. It's much easier
to use custom queries for this, as long as you clean your own data.

I also wish to know how to do this without breaking cake conventions.

On Feb 21, 7:51 pm, rtconner <[EMAIL PROTECTED]> wrote:
> I have no found a good way to do GROUP BY queries or INNER JOIN's in
> cake.
> Was wondering if any of you have come across these and how you handled
> them. I have not been able to do either of them in conjunction with
> the find() method in any normal way.Perhaps I am missing something?
> I'd love to find out if I am. Are these some sort of database specific
> constructs?
>
> With Group by, sometimes I can get away with appending $conditions[] =
> 'GROUP BY field'; annd the in addition to that, manually passing in
> the fields to find() and prepending DISTINCT to the id column.
>
> Inner Join I have seen zero support from in Cake. Any time I've wanted
> to Inner join I've had to write the query manually. You know,
> sometimes you just need to filter your queries based on two tables,
> not just your primary table.
>
> Any help on these issues would be greatly appreaciated. I know I am
> not the only one who has had trouble with them.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Two things I have not seen support for in Cake (group by and inner join)

2008-02-21 Thread rtconner

I have no found a good way to do GROUP BY queries or INNER JOIN's in
cake.
Was wondering if any of you have come across these and how you handled
them. I have not been able to do either of them in conjunction with
the find() method in any normal way.Perhaps I am missing something?
I'd love to find out if I am. Are these some sort of database specific
constructs?

With Group by, sometimes I can get away with appending $conditions[] =
'GROUP BY field'; annd the in addition to that, manually passing in
the fields to find() and prepending DISTINCT to the id column.

Inner Join I have seen zero support from in Cake. Any time I've wanted
to Inner join I've had to write the query manually. You know,
sometimes you just need to filter your queries based on two tables,
not just your primary table.

Any help on these issues would be greatly appreaciated. I know I am
not the only one who has had trouble with them.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---