Jump to content

Select first row first column value


ZeroShade
 Share

Recommended Posts

  • 2 weeks later...

hi as justsomeguy tell you , you can use limit fuction in mysql database to view a spicific number of colmuns and there are many functions to get spicific data like max vlaue >> select max(col) from tbl min value >> select min(col) from tbl sum >> select sum(col) from tbl Matar

Link to comment
Share on other sites

when i use this query in ms sql select product_id from orders Limit 1i have found an error Incorrect syntax near '1'.plz explain
If you're using MS SQL, then that "limit" syntax is invalid, and you would need the "top" keyword instead:
select top 1 product_id from orders

Link to comment
Share on other sites

Actually the new version of SQL Server finally includes LIMIT. Since the error message doesn't say LIMIT is wrong, it sounds like you have that version. But you need 2 parameters for LIMIT, the record to start with and the number to get. If you want to get the first record you would use LIMIT 0,1. If you want to get 10 records starting at the fiftieth one you would use LIMIT 50,10.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...