ZeroShade Posted October 16, 2007 Share Posted October 16, 2007 How can I get the number thats in the first row first column of my table? How can I select something that specific? Link to comment Share on other sites More sharing options...
justsomeguy Posted October 16, 2007 Share Posted October 16, 2007 SELECT field FROM table LIMIT 1 Link to comment Share on other sites More sharing options...
Matar Posted October 26, 2007 Share Posted October 26, 2007 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 More sharing options...
tariq_ews Posted October 26, 2007 Share Posted October 26, 2007 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 Link to comment Share on other sites More sharing options...
Reg Edit Posted October 26, 2007 Share Posted October 26, 2007 when i use this query in ms sql select product_id from orders Limit 1i have found an error Incorrect syntax near '1'.plz explainIf 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 More sharing options...
tariq_ews Posted October 26, 2007 Share Posted October 26, 2007 oh thanks select top 1 product_id from ordersi just found half min. ago thanks a lot red_edit thanks again Link to comment Share on other sites More sharing options...
justsomeguy Posted October 26, 2007 Share Posted October 26, 2007 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.