Casey Bralla on 16 Aug 2008 17:28:28 -0700 |
I'm working on a python application which accesses data in a MySQL database. I'm hoping somebody here is knowledgeable of this. I want to select a sequence of records in a specific order. I can select a specific record without any problem, but when I select the next one, it's not in the order I expect. Here's a simplified version of my code: import MySQLdb # Load the MySQL Python module # Connect to the server Database=MySQLdb.connect(db = MyDatabase, user = DatabaseUser, passwd = DatabasePassword, host = DatabaseHost) # # Fetch the first value DatabaseCursor = Database.cursor() Result=DatabaseCursor.execute("SELECT Item FROM Database ORDER BY DesiredOrder) # So far, so good! # # Now try to get the next record IN THE SAME ORDER! Result = DatabaseCursor.fetchone() # :( Unfortunately, It does not retrieve the next one in order. It has some other order (the sequence the database was built, I guess.) Anybody got an idea how to get "next" in mySQL? -- Casey Bralla Chief Nerd in Residence The NerdWorld Organisation ___________________________________________________________________________ Philadelphia Linux Users Group -- http://www.phillylinux.org Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug
|
|