Skip to Content
0
Aug 21, 2018 at 03:06 AM

Is it possible to query of only first and second date of the customer?

86 Views

 I tried doing the UP TO 2 ROWS but it only limits the table only to 2 rows.Is it possible to query thats only first and second date of the customer? I tried doing the UP TO 2 ROWS but it only limits the table only to 2 rows.
    SELECT knvv~kunnr vbak~vbeln vbak~erdat FROM vbak INNER JOIN knvv ON vbak~kunnr = knvv~kunnr.
The sample result of the above query would be:
    Customer no.    Document No            Date
    1               100000                 01/01/18
    1               200000                 01/02/18
    1               300000                 01/03/18
    1               400000                 01/04/18
    2               100001                 01/01/18
    2               200000                 01/04/18
    2               100040                 01/06/18
But what i need that it only limits the first two dates per customer. The result must be like this. It should only get like the first two dates of each customer just like the result below. Is it possible to do it in the query?
    Customer no.    Document No            Date
    1               100000                 01/01/18
    1               200000                 01/02/18
    2               100001                 01/01/18
    2               200000                 01/04/18