Then you just have to come up with some other criteria for determining who
should be counted as "before" or "after" Joe, which might well be the same
as the order by clause in whatever you're doing right now while examining
the result set.
I think your approach of examining the result set will wo
That is a nice idea, I'll have to keep it in my bag of tricks.
However, I don't know if it will work b/c there are probably others
that are hired on the same date...
On Apr 4, 2007, at 1:51 PM, Dan Buettner wrote:
James, one option would be to run a query to find the number of
people in
th
Ave.
Farmington, CT 06032
860.674.8796 / FAX: 860.674.8341
-Original Message-
From: James Tu [mailto:[EMAIL PROTECTED]
Sent: Wednesday, April 04, 2007 1:05 PM
To: James Tu
Cc: MySQL List
Subject: Re: Finding a record in a result set
Right now I'm trying to use PHP to do a binary search on the
James, one option would be to run a query to find the number of people in
the list ahead of him, rather than determining position within the result
set.
As in:
SELECT COUNT(*) FROM some_table
WHERE state = "Maine"
AND hire_date < (SELECT hire_date FROM some_table
WHERE last_name = "Smith"
AND fi
nformation Incorporated
195 Farmington Ave.
Farmington, CT 06032
860.674.8796 / FAX: 860.674.8341
> -Original Message-
> From: James Tu [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, April 04, 2007 1:05 PM
> To: James Tu
> Cc: MySQL List
> Subject: Re: Finding a record in a
Right now I'm trying to use PHP to do a binary search on the result
set so I don't have to traverse the entire result set.
I'm using PHP's mysql_data_seek() to move the pointer within the
result set and looking at the data.
What do people think of this approach?
-James
On Mar 22, 2007, a
Thanks Maciek:
The table that I'm doing this query on will be huge. It's
essentially the users table for an online activity with, we hope,
lots of users. :)
The thing is that if I do a query for the entire result set and use
PHP to figure out the position of the user and then do a query o
Let me describe the problem another way, too. It's related to
creating a paging interface to view many records. I figured that
people deal with paging all the time and the solution to my problem
may already be out there.
Typically when you access a single record via a top down method, i.e
"James Tu" <[EMAIL PROTECTED]> wrote in message =
news:[EMAIL PROTECTED]
> I want to do a query of all employees from Maine, ordered by hiring =20
> date, and figure out where Joe falls in that list. (i.e. which record =
> number is he?)
I think this can only be accomplished with a temporary ta
omething?
Regards,
Jerry Schwartz
Global Information Incorporated
195 Farmington Ave.
Farmington, CT 06032
860.674.8796 / FAX: 860.674.8341
-Original Message-
From: Peter Brawley [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 22, 2007 12:33 PM
To: James Tu
Cc: MySQL List
Subject:
t: Re: Finding a record in a result set
>
> >I want to do a query of all employees from Maine, ordered
> by hiring date,
> >and figure out where Joe falls in that list. (i.e. which
> record number
> is he?)
>
> If 'Joe' is a unique name LOL...
>
> SELEC
Remember
ME is Maine
MA is Massachusettes
- Original Message -
From: "Peter Brawley" <[EMAIL PROTECTED]>
To: "James Tu" <[EMAIL PROTECTED]>
Cc: "MySQL List"
Sent: Thursday, March 22, 2007 12:32:41 PM (GMT-0500) Auto-Detected
Subject: Re: Findin
ing scheme.
Now get ID from tmpEmpFromState for Employee Joe Cool
SELECT ID FROM tmpEmpFromState WHERE EMPNAME='Cool, Joe';
Give it a try.
- Original Message -
From: "James Tu" <[EMAIL PROTECTED]>
To: "MySQL List"
Sent: Thursday, March 22, 2007 11:21:34
>I want to do a query of all employees from Maine, ordered by hiring date,
>and figure out where Joe falls in that list. (i.e. which record number
is he?)
If 'Joe' is a unique name LOL...
SELECT 1 + COUNT(*)
FROM employees
WHERE name <> 'Joe' AND state = 'MA' AND hiredate < ;
PB
James Tu wro
Is there some quick way to do the following in MySQL? (I know I can
use PHP to search through the result set, but I wanted to see if
there's a quick way using some sort of query)
Let's say I know that Joe is from Maine.
I want to do a query of all employees from Maine, ordered by hiring
da
15 matches
Mail list logo