Re: [GENERAL] Group By Question

2010-10-05 Thread Chris Velevitch
That's getting too complicated. It can be done simply as: SELECT DISTINCT(test.people.id) test.people.id, test.people.name, test.likes.ref FROM test.people LEFT JOIN test.likes ON test.people.id = test.likes.ref ORDER BY test.people.id, test.likes.date DESCENDING Assuming people.id is unique, the

Re: [GENERAL] Group By Question

2010-10-02 Thread Christian Ullrich
* Andrew E. Tegenkamp wrote: I have two tables and want to attach and return the most recent data from the second table. Table 1 has a counter ID and name. Table 2 has a counter ID, Reference (to Table 1 ID), Date, and Like. I want to do a query that gets each name and their most recent like. I

Re: [GENERAL] Group By Question

2010-10-01 Thread Darren Duncan
Andrew E. Tegenkamp wrote: I have two tables and want to attach and return the most recent data from the second table. Table 1 has a counter ID and name. Table 2 has a counter ID, Reference (to Table 1 ID), Date, and Like. I want to do a query that gets each name and their most recent like. I ha

[GENERAL] Group By Question

2010-10-01 Thread Andrew E. Tegenkamp
I have two tables and want to attach and return the most recent data from the second table. Table 1 has a counter ID and name. Table 2 has a counter ID, Reference (to Table 1 ID), Date, and Like. I want to do a query that gets each name and their most recent like. I have a unique key setup on like

Re: [GENERAL] Group By question

2007-10-18 Thread brian
Jeff Lanzarotta wrote: Sam Mason <[EMAIL PROTECTED]> wrote: On Tue, Oct 16, 2007 at 07:46:34AM -0700, Jeff Lanzarotta wrote: Hello, I have a table that looks something like this: SKU Dept Col1 Col2 Col3 --- -- --- --- -- 1112 3

Re: [GENERAL] Group By question

2007-10-18 Thread Jeff Lanzarotta
Okay, actually the query is something like: select dept, (col1 + col2) * col3) from table group by dept So, the output would look something like: DeptTotal -- --- 1 26 2 18 3 9 Sam Mason <[EMAIL PROTECTED]> wrote: On Tue, Oct 16, 2007 at 07:46:34AM -0700,

Re: [GENERAL] Group By question

2007-10-16 Thread Scott Marlowe
On 10/16/07, Jeff Lanzarotta <[EMAIL PROTECTED]> wrote: > Hello, > > I have a table that looks something like this: > > SKU Dept Col1 Col2 Col3 > --- -- --- --- -- > 1112 3 > 2123 4 > 321

Re: [GENERAL] Group By question

2007-10-16 Thread Sam Mason
On Tue, Oct 16, 2007 at 07:46:34AM -0700, Jeff Lanzarotta wrote: > Hello, > > I have a table that looks something like this: > > SKU Dept Col1 Col2 Col3 > --- -- --- --- -- > 1112 3 > 2123 4 > 32

[GENERAL] Group By question

2007-10-16 Thread Jeff Lanzarotta
Hello, I have a table that looks something like this: SKU Dept Col1 Col2 Col3 --- -- --- --- -- 1112 3 2123 4 3210 1 4201 2 524