Re: How to use SQL "LIMIT" keyword against an MDB file



On Tue, 29 Jan 2008 10:55:42 -0600, Steve wrote:

"Ivan Marsh" <annoyed@xxxxxxx> wrote in message
news:pan.2008.01.29.16.23.04.896088@xxxxxxxxxx
On Mon, 28 Jan 2008 17:08:29 -0600, Steve wrote:
"Ivan Marsh" <annoyed@xxxxxxx> wrote in message
news:pan.2008.01.28.22.40.54.715306@xxxxxxxxxx
On Mon, 28 Jan 2008 16:09:32 -0600, Steve wrote:
"Ivan Marsh" <annoyed@xxxxxxx> wrote in message
news:pan.2008.01.28.21.50.48.197643@xxxxxxxxxx
On Mon, 28 Jan 2008 14:37:03 -0700, Martin wrote:

I'm trying to adapt a PHP script that was written to use MySQL, so
that it will work with an MSAccess MDB file.

An important part of the script makes use of the SQL "LIMIT"
keyword available in MySQL. eg: "SELECT MyField FROM MyTable LIMIT
40,10" to select 10 records beginning at the 41st record.

Can anyone tell me how I can achieve this same functionality when
using ODBC functions to access an MDB file? I think I can set
ROWCOUNT (or possibly TOP) to retrieve only 10 records but how do
I get it to start at the 41st record?

You just lost an enormous amount of functionality. I'm assuming
this is something you had to do.

Pull all of the records and then programatically strip out the
records you don't want from the array.

are you out of your fucking mind?!!!

I assure you I'm not... though I don't claim to be Mr. Grand Wizard
PHP Programmer Guy.

yeah, let me pull all the records from my 55 million rowed table
into a php array...

Can you fit 55 million rows in an Access database that's less than 2
gigs?

let me assure you, if you pull even 2MB of data into an array just to
pseudo-query (i.e. removed unwanted data) then you're not using your
tools wisely. the only thing that should be returned from ANY db is
*just* the data you want...nothing more.

Indeed. "All the records" in my above statement should be read "All the
records needed" not "The entire dataset". The odbc_exec query should be
used to produce the smallest dataset possible and then strip out the
data not needed.

hmmm, then you're still crazy. :)

the db should be used to return *only* the data needed. there should be
nothing for you to have to strip out. what consitutues 'data needed' for
the op are only the records between x and n. getting all the records and
stripping out everything but x through n using php is ludicrous.

Except you've just "solved" his issue with a database redesign. I'm
assuming if he had any say over the database design he wouldn't have moved
from MySQL to Access in the first place.

Redefining the problem isn't solving the problem.

Assume for instance the dataset he's interested in is all records that
include California in the state field. Your fix just died on the vine.

--
I told you this was going to happen.

.