List:General Discussion« Previous MessageNext Message »
From:Arthur Fuller Date:December 3 2011 9:35pm
Subject:Re: How to get a specific number of entries per one key ?
View as plain text  
A quick guess, or at least a starting point:

SELECT key, data
FROM myTable
GROUP BY key
LIMIT 2

HTH,
Arthur

On Sat, Dec 3, 2011 at 11:41 AM, Blog Tieng Viet <blogtiengviet@stripped>wrote:

> Hellow everybody.
>
> I have a problem difficult for me, please give me an advice.
>
> I want to get a specific number of entry (rows) from a table
> by each Key. If the number is 1, I can use "select dinstinct",
> but the number is not 1, I don't know how to select.
>
> For example:
>
> Key 0 | data 0-0
> Key 0 | data 0-1
> Key 0 | data 0-2
> Key 1 | data 1-0
> Key 1 | data 1-1
>
> I want to select 2 data for each key.
> Key 0 (data 0-0, data 0-1), Key 1 (data 1-0, data 1-1).
>
> How to describe in query ?
>
> Best regards.
>

Thread
delete syntaxTim Dunphy2 Dec
  • Re: delete syntaxKrishna Chandra Prajapati2 Dec
    • Re: delete syntaxTim Dunphy2 Dec
      • Re: delete syntaxShiva2 Dec
        • Re: delete syntaxReindl Harald2 Dec
          • Re: delete syntaxStdranwl2 Dec
            • Re: delete syntaxReindl Harald2 Dec
              • Re: delete syntaxClaudio Nanni2 Dec
                • Re: delete syntaxReindl Harald2 Dec
                  • Re: delete syntaxGovinda2 Dec
                    • How to get a specific number of entries per one key ?Blog Tieng Viet3 Dec
                      • Re: How to get a specific number of entries per one key ?Arthur Fuller3 Dec
                        • Re: How to get a specific number of entries per one key ?Rik Wasmus5 Dec
    • Re: delete syntaxKeith Keller2 Dec