[nmglug] query masters??
Bill York
iago at pobox.com
Fri Mar 4 14:20:53 PST 2011
with the trailing ;
---
Bill York
762-233-7568
On Fri, Mar 4, 2011 at 2:53 PM, Bill York <iago at pobox.com> wrote:
> try this
>
> SELECT parent_id, question_id, Max(id) AS LastRecord FROM
> xxYourTablexx GROUP BY parent_id, question_id HAVING parent_id="1"
>
>
> ---
> Bill York
> 762-233-7568
>
>
> On Fri, Mar 4, 2011 at 2:48 PM, Andres Paglayan <andres at paglayan.com>wrote:
>
>> Hey,
>>
>> I need a query for the following,
>>
>> given a table with this vales
>>
>> | id | parent_id | question_id |
>> | 1 | 1 | 1 |
>> | 2 | 1 | 1 |
>> | 3 | 1 | 2 |
>> | 4 | 1 | 2 |
>>
>>
>> Knowing only that I am searching for the parent_id = 1
>> I need a query that searches for
>> parent_id = 1 and then for each matching record, the older entry,
>> meaning the result should only have the records with id 2 and 4,
>>
>> any hint?
>>
>>
>>
>>
>> _______________________________________________
>> nmglug mailing list
>> nmglug at lists.nmglug.org
>> http://lists.nmglug.org/listinfo.cgi/nmglug-nmglug.org
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nmglug.org/pipermail/nmglug-nmglug.org/attachments/20110304/504b132c/attachment.htm>
More information about the nmglug
mailing list