In the last episode (Jul 23), Jan Peuker said:
> Dan Nelson wrote:
> > So what you really want is
> >
> > CREATE TEMPORARY TABLE tmp
> > SELECT code FROM mytable WHERE zip < 12345 ORDER BY zip DESC LIMIT 5;
> > INSERT INTO tmp
> > SELECT code FROM mytable WHERE zip = 12345;
> > INSERT INTO tmp
>
But now I think it's the only way.
jan
- Original Message -
From: "Dan Nelson" <[EMAIL PROTECTED]>
To: "Jan Peuker" <[EMAIL PROTECTED]>
Cc: "Gurhan Ozen" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, July 22, 2002 11:35
In the last episode (Jul 22), Jan Peuker said:
> What I want to do is, select the 10(say, a value) nearest values to a
> given number. The easiest way would be "near 5" shows 1..10. The
> problem is, the number should affect rows, not values, because values
> are not unique nor in order. What I wa
gits or you can add 0's on the end
of your 5 digit ZIP's with RPAD().
Gordon Bruce
Interstate Software
A MySQL Training & Consulting Partner
> -Original Message-
> From: Jan Peuker [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 22, 2002 12:54 PM
> To: Gurhan Ozen
It isn't in one statement, but what about, after you get your zip code
select * from table where zip < yourzip order by zip desc limit 5
select * from table where zip > yourzip order by zip limit 5
On Monday, July 22, 2002, at 12:53 PM, Jan Peuker wrote:
> Hi,
>
> sorry for my bad earlier exp
L PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, July 22, 2002 1:53 PM
Subject: Re: Surrounding Rows
> Hi,
>
> sorry for my bad earlier explanation.
> What I want to do is, select the 10(say, a value) nearest values to a
given
> number. The easiest way would be "near
very safe.
Thanks a lot,
jan
- Original Message -
From: "Gurhan Ozen" <[EMAIL PROTECTED]>
To: "Jan Peuker" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, July 22, 2002 7:39 PM
Subject: Re: Surrounding Rows
> Hi,
> Can you please explain
;Jan Peuker" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, July 22, 2002 11:03 AM
Subject: Surrounding Rows
> Hi list,
>
> A nut to crack:
> I have a medium-sized database(about 1000 rows). The keys contain
> zip-address-information. Now I want to get t
Hi list,
A nut to crack:
I have a medium-sized database(about 1000 rows). The keys contain
zip-address-information. Now I want to get the surrounding persons, e.g.
someone has zip 12345 I would get(now for 4 entries):
+---+--+
| 12340 | personA |
| 12345 | personB | <-- I searched