Delete Row from

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Benniit
    New Member
    • May 2008
    • 54

    Delete Row from

    Am using vb.net 2008 and sql 2008

    How can I delete the last row of a record based on the condition that if the column
    FileNo is more than 15 then it should get deleted order by Fdate column desc.

    I want the rows should get deleted from starting from the last row.

    Thanks Gurus

    Ben
  • yarbrough40
    Contributor
    • Jun 2009
    • 320

    #2
    How can I delete the last row of a record...
    a "Row" and a "Record" are synonomous - so that is a bit confusing. I think you mean "the last row of a "query". The way I would do it is move your last row to become the first row in the query. Then delete only that first row.

    Code:
    DELETE TOP 1 FROM MyTable WHERE FileNo > 15 ORDER BY Fdate;

    Comment

    Working...