6 Replies Latest reply: Oct 16, 2012 6:56 AM by Kabilan Kumarasamy RSS

    How to get the last 10 record of table?

    Kabilan Kumarasamy

      Hi all,

       

      I want to know how to get the last 10 or more record of table?

       

      Please help me.

       

      Thanks in advance..

       

      Regards,

      Kabilan K.

        • Re: How to get the last 10 record of table?
          Jason Michaelides

          If you are using v11 you can use dimension limits. If not, try Rank() with Aggr(). Maybe something like,

           

          Aggr(If(Rank(Sum(Sales))>=Max(Rank(Sum(Sales)))-10,Customer),Customer) as your dimension.

           

          Hope this helps,

           

          Jason

            • Re: How to get the last 10 record of table?
              Kabilan Kumarasamy

              Hi,

               

              I am using V11, So tell me about dimension limit.

               

              Because, my table doesn't have a any numeric column So This expresion is not work (Aggr(If(Rank(Sum(Sales))>=Max(Rank(Sum(Sales)))-10,Customer),Customer)).

               

              Table is like this:

               

              LOAD @1 as FirstDate, //this field have a date, Some dates are very and some dates are same

                                                                                                             @2 as Information, //this field have string as 'Information'

                                                                                                             @3 as Basedate // This field have Date and some string value

                                                                                                           

                                                                                                        FROM

                                                                                                        [$(FoundFile)]

                                                                                                        (txt, utf8, no labels, delimiter is '\t', msq);

               

              Here, how can I get the last 10 record?

               

              Thanks in advance.

               

              Regards,

              Kabilan K.

            • Re: How to get the last 10 record of table?
              jagan mohan rao appala

              Hi,

               

              To get last 10 records of a table in script you can use First attribute and by using Order the table in descending order.

               

              TableName:

              First 10 Load

              *

              from abc.qvd

              Order by Id desc;

               

              Hope this helps you.

               

              There is no direct way to get last 10 records.

               

              Regards,

              Jagan.

              • Re: How to get the last 10 record of table?

                Hi Kabilan,

                 

                You can add the RowNo() function in the table and based on that you can get the max rowno() and in the expression if you write RowID-10 then you will get the last 10 records.

                 

                Thanks,

                Srini.

                • Re: How to get the last 10 record of table?
                  Deepak Kurup

                  HI Kabilan,

                   

                   

                  Try the attach method.

                   

                   

                   

                  Deepak