|
Posted by Steve on 01/29/08 19:34
"Ivan Marsh" <annoyed@you.now> wrote in message
news:pan.2008.01.29.17.52.30.501620@you.now...
> On Tue, 29 Jan 2008 10:55:42 -0600, Steve wrote:
>
>> "Ivan Marsh" <annoyed@you.now> wrote in message
>> news:pan.2008.01.29.16.23.04.896088@you.now...
>>> On Mon, 28 Jan 2008 17:08:29 -0600, Steve wrote:
>>>> "Ivan Marsh" <annoyed@you.now> wrote in message
>>>> news:pan.2008.01.28.22.40.54.715306@you.now...
>>>>> On Mon, 28 Jan 2008 16:09:32 -0600, Steve wrote:
>>>>>> "Ivan Marsh" <annoyed@you.now> wrote in message
>>>>>> news:pan.2008.01.28.21.50.48.197643@you.now...
>>>>>>> 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.
however i did not redefine his problem. i eliminated the problem by taking
it out of the design. if that calls for a redesign that costs him nothing,
there's simply nothing left to consider.
> 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 don't see how. even if you have n criteria and different ordering, it
still works just fine.
select <field list>
into <temp table with autonum>
from blah
where state = 'CA'
select <field list>
from <temp table>
where id <the autonum field> between x and n
this can also be done with one statement, bypassing the need for an
on-the-fly temp table - just sticking with original suggestion. those using
oracle know what i'm talking about...ROWNUM is a wonderful thing...esp. when
used on derived-tables/sub-queries. there are simpler solutions available to
access as well, the op just didn't state the version he was using...hence,
the lowest common denominator suggestion of temp tables.
but please, demonstrate how my fix 'just died on the vine'.
fyi, oracle:
select *
from
(
select ROWNUM section ,
<field list>
from blah
where state = 'CA'
)
where section between x and n
Navigation:
[Reply to this message]
|