I have a database table which stores names of people, i want to fetch the first entry of my database table. Is it possible using SQL query?
Use the following:
SELECT * FROM names LIMIT 1
And if you want the first sorted entry, then use the following:
SELECT n.* FROM names n ORDER BY n.last_name ASC, n.first_name ASC LIMIT 1
you can use
select first(column_name) from table_name order by primary_id
first().is an aggregate function available for mssql
you can also go for 'top' in mssql