RE: Show row number
Alternatively, you could try something like this : SET @rownum = 0; SELECT @rownum := @rownum + 1 AS rownumber_column, some_real_columnnames FROM your_table LIMIT 100 -Original Message- From: Clyde Lewis [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 25, 2006 3:14 PM To: [EMAIL PROTECTED] Cc: MySQL List Subject: Re: Show row number Excellent explanation. Thanks again. CL At 02:00 PM 1/25/2006, [EMAIL PROTECTED] wrote: Clyde Lewis [EMAIL PROTECTED] wrote on 01/25/2006 01:41:30 PM: Is there a command in mysql that will return the row number. I tried rownum and rownum() No, rows do not exist in the base data of a MySQL database. They are called records and records may be stored in any order. Within some MySQL storage engines (particularly InnoDB), more than one of any record may exist in the database at the same time (depending on transaction activity) or in more than one place (NDB). Within the results of a SELECT query, the individual row number is only important to the client. You need to use whatever number your client library provides for you.( ex: in ADO you would use the Recordset.AbsolutePosition property) There is no internal record number that is exposed through any interface to any client. Now, there is a pointer to each record but that is not useful information to any system except the database server itself and cannot be used to query for a particular record because it is not part of the data but it is part of the metadata associated with each record. Records can move around within a database file (changing their pointers) so long as the data pointed to does not change. Shawn Green Database Administrator Unimin Corporation - Spruce Pine *** Clyde Lewis Database Administrator General Parts, Inc. 919-227-5100 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: How to get around lack of views?
Wouldn't some variation on a MERGE table help with this? -Original Message- From: Jeremy Zawodny [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 30, 2004 2:45 PM To: Michael J. Pawlowsky Cc: [EMAIL PROTECTED] Subject: Re: How to get around lack of views? On Mon, Mar 29, 2004 at 03:58:29PM -0500, Michael J. Pawlowsky wrote: How would I do this? Let say I have an employee table with Name varchar(64) Dept int(11); Salary int(11); I want to grant select on Salary to a mysql user but only where dept = 1 let's say. Normally I would create a view to do something like this. . But I was wondering if there would be another way around this until views are implemented that someone has thought of. Honestly, if you need views at the db level, MySQL is not for you. Jeremy -- Jeremy D. Zawodny | Perl, Web, MySQL, Linux Magazine, Yahoo! [EMAIL PROTECTED] | http://jeremy.zawodny.com/ MySQL 4.0.15-Yahoo-SMP: up 198 days, processed 3,393,557,554 queries (197/sec. avg) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]