Query to Get the Random Records from a Table in a Database.
Supoose we want to show 5 Random News on main page of the website.
Example:
Table Name:tblNews
Columns: NewsID,Description,DatePosted
SELECT TOP 5 NewsID,Description,DatePosted FROM tblNews ORDER By NEWID()
OUTPUT: 5 News will be fetched from table at Random. each times 5 different news will be picked from the table. Thanks & Regards
Lakhan Pal Garg