I want to delete some records that are on the top by the date and time.
the error is near 2, (the value of no_of_recordss)
DELETE TOP " + no_of_recordss + " FROM [upload_news] WHERE [country]='" + countryy.Text + "' ORDER BY [upload_time] ASC"
I want to delete some records that are on the top by the date and time.
the error is near 2, (the value of no_of_recordss)
DELETE TOP " + no_of_recordss + " FROM [upload_news] WHERE [country]='" + countryy.Text + "' ORDER BY [upload_time] ASC"
Try like this
;WITH CTE AS
(
SELECT TOP " + no_of_recordss + " *
FROM [upload_news]
WHERE [country]='" + countryy.Text + "'
ORDER BY [upload_time] ASC
)
DELETE FROM CTE