Query

  • Hi

      I have below Data .

    DateAmountLocationPosted DatePosted AmountCamountStatus
    01/10/20173,400.00AMB00Open
    03/10/20172,100.00AMB02,100.00Open
    04/10/20174,801.00AMB04,801.00Open
    05/10/20178,577.00AMB00Open
    07/10/2017500AMB00Open
    08/10/201717,360.00AMB00Open
    03/10/20170AMB03/10/20172,000.002,100.00Closed
    04/10/20170AMB04/10/20174,801.004,801.00Closed
    03/10/20170AMB05/10/20171002,100.00Closed

    I want to display those records which have Status Open and their records with Status = 'Posted. . For e.g in below data like this

    DateAmountLocationPosted DatePosted AmountCamountStatus
    01/10/20173,400.00AMB00Open
    03/10/20172,100.00AMB02,100.00Open
    03/10/20170AMB03/10/20172,000.002,100.00Closed
    03/10/20170AMB05/10/20171002,100.00Closed
    04/10/20174,801.00AMB04,801.00Open
    04/10/20170AMB04/10/20174,801.004,801.00Closed
    05/10/20178,577.00AMB00Open
    07/10/2017500AMB00Open
    08/10/201717,360.00AMB00Open

    Thanks

  • select Date    ,Amount,    Location,    [Posted Date],    [Posted Amount],    Camount,Status
    from Tablename
    where status ='posted'

    ***The first step is always the hardest *******

  • jagjitsingh - Sunday, May 27, 2018 10:44 AM

    Hi

      I have below Data .

    DateAmountLocationPosted DatePosted AmountCamountStatus
    01/10/20173,400.00AMB00Open
    03/10/20172,100.00AMB02,100.00Open
    04/10/20174,801.00AMB04,801.00Open
    05/10/20178,577.00AMB00Open
    07/10/2017500AMB00Open
    08/10/201717,360.00AMB00Open
    03/10/20170AMB03/10/20172,000.002,100.00Closed
    04/10/20170AMB04/10/20174,801.004,801.00Closed
    03/10/20170AMB05/10/20171002,100.00Closed

    I want to display those records which have Status Open and their records with Status = 'Posted. . For e.g in below data like this

    DateAmountLocationPosted DatePosted AmountCamountStatus
    01/10/20173,400.00AMB00Open
    03/10/20172,100.00AMB02,100.00Open
    03/10/20170AMB03/10/20172,000.002,100.00Closed
    03/10/20170AMB05/10/20171002,100.00Closed
    04/10/20174,801.00AMB04,801.00Open
    04/10/20170AMB04/10/20174,801.004,801.00Closed
    05/10/20178,577.00AMB00Open
    07/10/2017500AMB00Open
    08/10/201717,360.00AMB00Open

    Thanks

    Not entirely sure what you mean (from your data) what you mean by "posted". Does that mean a non-null Date Posted?
    If that's the case then your WHERE clause is something like
    WHERE [Status] = 'Open' AND [Posted Date] IS NOT NULL;

  • Hi
      I want those records which have Status Open and their Amount - CAmount <> 0 then with Open record i want to display that Date Posted records. In my case Date 03/10/2017 has 3 records & date 04/10/2017 but their Amount - CAmount = 0 in their Open Status so they should not be displayed. It should display all other records.
    Thanks

  • select Date ,Amount, Location, [Posted Date], [Posted Amount], Camount,Status
    from Tablename
    where status ='posted' 
    and [Posted Amount] - Camount !=0

    ***The first step is always the hardest *******

  • SELECT [Date], AmountLocation, [Posted Date], [Posted Amount], Camount, [Status]
    FROM MyTable
    WHERE [Status]='Open' AND Amount - CAmount <> 0;

  • jagjitsingh - Sunday, May 27, 2018 10:44 AM

    Hi

      I have below Data .

    DateAmountLocationPosted DatePosted AmountCamountStatus
    01/10/20173,400.00AMB00Open
    03/10/20172,100.00AMB02,100.00Open
    04/10/20174,801.00AMB04,801.00Open
    05/10/20178,577.00AMB00Open
    07/10/2017500AMB00Open
    08/10/201717,360.00AMB00Open
    03/10/20170AMB03/10/20172,000.002,100.00Closed
    04/10/20170AMB04/10/20174,801.004,801.00Closed
    03/10/20170AMB05/10/20171002,100.00Closed

    I want to display those records which have Status Open and their records with Status = 'Posted. . For e.g in below data like this

    DateAmountLocationPosted DatePosted AmountCamountStatus
    01/10/20173,400.00AMB00Open
    03/10/20172,100.00AMB02,100.00Open
    03/10/20170AMB03/10/20172,000.002,100.00Closed
    03/10/20170AMB05/10/20171002,100.00Closed
    04/10/20174,801.00AMB04,801.00Open
    04/10/20170AMB04/10/20174,801.004,801.00Closed
    05/10/20178,577.00AMB00Open
    07/10/2017500AMB00Open
    08/10/201717,360.00AMB00Open

    Thanks

    Please see the article at the first link in my signature line below under "Helpful Links" for future posts.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply