Sql help please with, finding all zip codes within a given radius.

I have a table which contains zip, city, state, latdec, longdec, latrad, longrad.
From search screen, if user want, zip code's within 10 mile radius of his zip code, what is the sql. I came up with following sql but it is not correct:
first, find his latdec long dec from his zipcode. Then add radius to those values and do select as follows:
select zip,
latdec, longdec,
city, state, latrad, longrad
from zip_coord
where latdec >= (latdec - 10)
and latdec <= (latdec + 10)
and longdec >= (longdec - 10)and longdec <= (longdec + 10).
I think i need to include radians too, but i'm not able to come up with logical formula.
I would appreciate any help with this topic.
Thanks in advance

gautam ,
u probably need to use oracle spatial option and store geoCodes for each address as a column in the address table . then doing this will be easy

Similar Messages

  • Please help, finding all zip codes within a given radius.

    I have a table which contains zip, city, state, latdec, longdec, latrad, longrad.
    From search screen, user want's to find all zip code's, within
    10 mile radius of his zip code.
    I came up with following sql but it is not correct:
    First, find his latdec, longdec from his zipcode.
    Then add radius to those values and do select as follows:
    select zip,
    latdec, longdec,
    city, state, latrad, longrad
    from zip_coord
    where latdec >= (latdec - 10)
    and latdec <= (latdec + 10)
    and longdec >= (longdec - 10)and longdec <= (longdec + 10).
    I think i need to include radians too, but i'm not able to come up with logical formula.
    I would appreciate any help with this topic.
    Thanks in advance

    I am not sure I understand the gerography concept, but I think the query should be like this:
    select zip, latdec, longdec,city, state, latrad, longrad
    from zip_coord
    where latdec between( select latdec from zip_record where zip='userinput', select latdec+10 from zip_record where zip='userinput')
    and longdec between( select longdec from zip_record where zip='userinput', select longdec+10 from zip_record where zip='userinput')
    and latrad between( select latrad from zip_record where zip='userinput', select latrad+10 from zip_record where zip='userinput')
    and longrad between( select longrad from zip_record where zip='userinput', select longrad+10 from zip_record where zip='userinput')
    Hope, it can help.
    Aiping

  • Help please with rat maze results code

    Hey guys,
    Just asking for a little help here. I am trying to finish a java program for a class and I am stuck on a bit of code. I've figured out most of the code but am stuck on this piece of code at the end:
         * Gets the maze time for the rodent.
         * @return String The formatted maze time for the rodent.
        public String getMazeTime()
         * Gets a formatted string with information for the rodent and maze.
         * @return String String with information for rodent and maze.
        public String toString()
    Here is the code in its entirety:
    * Provides maze results for a rodent.
    * @author Ray Waite
    * @version December 2006
    public class MazeResult
        // instance variables
        private Rat rodent;
        private Time startTime;
        private Time endTime;
         * Constructor for objects of class MazeResult.
        public MazeResult(Rat inRat)
            myRat = inRat;
         * Sets the rodent.
         * @param inRat Rat object.
        public void setRat(Rat inRat)
            This.setRat = new Rat ();
         * Gets the rodent.
         * @return Rat The Rat object.
        public Rat getRat()
    return myRat;
         * Sets the start time for the rodent.
         * @param inHour Hour of the rodent's start time.
         * @param inMinutes Minutes of the rodent's start time.
         * @param inSeconds Seconds of the rodent's start time.
        public void setStartTime(int inHour, int inMinutes, int inSeconds)
            this.startTime = new Time(inHour, inMinutes, inSeconds);
         * Gets the start time for the rodent.
         * @return Time The start time of the rodent.
        public Time getStartTime()
            if (this.startTime == null)
                return null;
            Time tempStartTime = new Time(this.startTime.getHour(),
                this.startTime.getMinutes(), this.startTime.getSeconds());
            return tempStartTime;
         * Sets the end time for the rodent.
         * @param inHour Hour of the rodent's end time.
         * @param inMinutes Minutes of the rodent's end time.
         * @param inSeconds Seconds of the rodent's end time.
        public void setEndTime(int inHour, int inMinutes, int inSeconds)
            this.endTime = new Time(inHour, inMinutes, inSeconds);
         * Gets the end time for the rodent.
         * @return Time The end time of the rodent.
        public Time getEndTime()
            if (this.endTime == null)
                return null;
            Time tempEndTime = new Time(this.endTime.getHour(),
                this.endTime.getMinutes(), this.endTime.getSeconds());
            return tempEndTime;
         * Gets the maze time for the rodent.
         * @return String The formatted maze time for the rodent.
        public String getMazeTime()
         * Gets a formatted string with information for the rodent and maze.
         * @return String String with information for rodent and maze.
        public String toString()
    I would very much "love" some help. Thanks.
    Phil

    well, the maze time would probably have something to do with the difference between the start and end times.

  • Little help please with forwarding traffic to proxy server!

    hi all, little help please with this error message
    i got this when i ran my code and requested only the home page of the google at my client side !!
    GET / HTTP/1.1
    Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, */*
    Accept-Language: en-us
    UA-CPU: x86
    Accept-Encoding: gzip, deflate
    User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; InfoPath.2; .NET CLR 2.0.50727)
    Host: www.google.com
    Connection: Keep-Alive
    Cookie: PREF=ID=a21457942a93fc67:TB=2:TM=1212883502:LM=1213187620:GM=1:S=H1BYeDQt9622ONKF
    HTTP/1.0 200 OK
    Cache-Control: private, max-age=0
    Date: Fri, 20 Jun 2008 22:43:15 GMT
    Expires: -1
    Content-Type: text/html; charset=UTF-8
    Content-Encoding: gzip
    Server: gws
    Content-Length: 2649
    X-Cache: MISS from linux-e6p8
    X-Cache-Lookup: MISS from linux-e6p8:3128
    Via: 1.0
    Connection: keep-alive
    GET /8SE/11?MI=32d919696b43409cb90ec369fe7aab75&LV=3.1.0.146&AG=T14050&IS=0000&TE=1&TV=tmen-us%7Cts20080620224324%7Crf0%7Csq38%7Cwi133526%7Ceuhttp%3A%2F%2Fwww.google.com%2F HTTP/1.1
    User-Agent: MSN_SL/3.1 Microsoft-Windows/5.1
    Host: g.ceipmsn.com
    HTTP/1.0 403 Forbidden
    Server: squid/2.6.STABLE5
    Date: Sat, 21 Jun 2008 01:46:26 GMT
    Content-Type: text/html
    Content-Length: 1066
    Expires: Sat, 21 Jun 2008 01:46:26 GMT
    X-Squid-Error: ERR_ACCESS_DENIED 0
    X-Cache: MISS from linux-e6p8
    X-Cache-Lookup: NONE from linux-e6p8:3128
    Via: 1.0
    Connection: close
    java.net.SocketException: Broken pipe // this is the error message
    at java.net.SocketOutputStream.socketWrite0(Native Method)
    at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
    at java.net.SocketOutputStream.write(SocketOutputStream.java:115)
    at java.io.DataOutputStream.writeBytes(DataOutputStream.java:259)
    at SimpleHttpHandler.run(Test77.java:61)
    at java.lang.Thread.run(Thread.java:595)
    at Test77.main(Test77.java:13)

    please could just tell me what is wrong with my code ! this is the last idea in my G.p and am havin difficulties with that cuz this is the first time dealin with java :( the purpose of my code to forward the http traffic from client to Squid server ( proxy server ) then forward the response from squid server to the clients !
    thanx a lot,
    this is my code :
    import java.io.*;
    import java.net.*;
    public class Test7 {
    public static void main(String[] args) {
    try {
    ServerSocket serverSocket = new ServerSocket(1416);
    while(true){
    System.out.println("Waiting for request");
    Socket socket = serverSocket.accept();
    new Thread(new SimpleHttpHandler(socket)).run();
    socket.close();
    catch (Exception e) {
    e.printStackTrace();
    class SimpleHttpHandler implements Runnable{
    private final static String CLRF = "\r\n";
    private Socket client;
    private DataOutputStream writer;
    private DataOutputStream writer2;
    private BufferedReader reader;
    private BufferedReader reader2;
    public SimpleHttpHandler(Socket client){
    this.client = client;
    public void run(){
    try{
    this.reader = new BufferedReader(
    new InputStreamReader(
    this.client.getInputStream()
    InetAddress ipp=InetAddress.getByName("192.168.6.29"); \\ my squid server
    System.out.println(ipp);
    StringBuffer buffer = new StringBuffer();
    Socket ss=new Socket(ipp,3128);
    this.writer= new DataOutputStream(ss.getOutputStream());
    writer.writeBytes(this.read());
    this.reader2 = new BufferedReader(
    new InputStreamReader(
    ss.getInputStream()
    this.writer2= new DataOutputStream(this.client.getOutputStream());
    writer2.writeBytes(this.read2());
    this.writer2.close();
    this.writer.close();
    this.reader.close();
    this.reader2.close();
    this.client.close();
    catch(Exception e){
    e.printStackTrace();
    private String read() throws IOException{
    String in = "";
    StringBuffer buffer = new StringBuffer();
    while(!(in = this.reader.readLine()).trim().equals("")){
    buffer.append(in + "\n");
    buffer.append(in + "\n");
    System.out.println(buffer.toString());
    return buffer.toString();
    private String read2() throws IOException{
    String in = "";
    StringBuffer buffer = new StringBuffer();
    while(!(in = this.reader2.readLine()).trim().equals("")){
    buffer.append(in + "\n");
    System.out.println(buffer.toString());
    return buffer.toString();
    Edited by: Tareq85 on Jun 20, 2008 5:22 PM

  • Help please...All menus grayed out in CS4...

    Premiere Pro used to work and a few weeks ago when I openned it, all of the menu items were grayed out and no editing panel or anything openned. I can't even quit the program. Literally everything is grayed out.
    There is nothing I can do with it.  I have uninstalled the entire Master Collection using the Adobe Installers and double checked to make sure things were cleaned up by using the Creative Suite Cleaner Tool.I have also attempted to just reinstall Premiere Pro from the disks to no avail.
    All other programs in the suite apprear to load and work fine. Only Premiere Pro CS4 does not work.
    Any ideas on how to fix this issue? I really need to be able to use the program and can't yet afford to upgrade to CS5.5... so any help would be appreciated.
    Thanks guys!
    David

    Thanks Bill. No worries... Haa, haa. I should have asked MYSELF about the second monitor.
    REALLY appreciate the help and care.
    Blessings bro.
    David
    Date: Thu, 14 Jul 2011 09:54:35 -0600
    From: [email protected]
    To: [email protected]
    Subject: Help please...All menus grayed out in CS4...
    The second monitor has been an issue with several programs. Photoshop is one too.
    There is another thread, where a user was getting the "bing," that a window was open, but could not see it. Sure enough, it was on his second monitor, that had been disconnected. I should have asked if you had ever had a second monitor. I am the "dunce."
    Glad that you located the problem and good luck,
    Hunt
    >

  • Help please with FaceTime. The built in app seems to have disappeared from my iPad2. Bought it in Australia

    Help please with FaceTime. My built in app seems to have disappeared.

    If K Penguin's suggestion doesnt work, you will have to go to you iTunes and do a reset, that is if you do not have it in your back up library.

  • Having problem buying online.need your help since it's my first time here.apple is asking for my billing address but when i enter my address here in qatar,it's saying i should enter a valid zip code within the u.s.does it mean i can't buy online

    having problem buying online.need your help since it's my first time here.apple is asking for my billing address but when i enter my address here in qatar,it's saying i should enter a valid zip code within the u.s.does it mean i can't buy online even if it wil be shipped within u.s. only?

    To buy in for delivery in Qatar, you should be starting from the Apple Qatar site:
    http://www.apple.com/qa/
    Do you have an Apple-ID? if you do, then you should not have to enter your Address again, and may be able to sidestep the US Zip Code issue.

  • Can anyone help please with my Time Machine, I have been getting the following message The backup disk image "/Volumes/Mac Backup/Stephen Smith's iMac.sparsebundle" is already in use.

    Can anyone help please with my Time Machine, I have been getting the following message The backup disk image “/Volumes/Mac Backup/Stephen Smith’s iMac.sparsebundle” is already in use.

    See > http://pondini.org/TM/C12.html

  • Help please with 2006 Macbook 13inch, for tv hook up.

    Help please with 2006 Macbook 13inch, to hook up to tv for streaming. The display works through VGA but the audio isn't working. Got a plug that goes into headphone jack on computer and connects into the audio jack on the back of tv but no sound. I'm not quite sure what the issue is, whether its the wrong plug, the tv, or the computer. Best Buy says this is the right plug and it seems that it would be, but who knows. If anyone has any experience in this, I would appreciate the help!

    Make sure those audio plugs are matched with the VGA plug. With your MacBook running something with audio switch between your sources on the TV Component, Composite and such. See if the sound is coming from another source. If so then you've got your audio plugs in the wrong jacks.
    Also could you post the make and model number of your TV.

  • Help Please with Driver

    I need to install the ADB Interface for the X2 onto my computer. Does any one know how or where I can get this driver?

    <Duplicate post.  Please see Help Please with Driver  for any replies.  This post will be closed.>

  • Please help me to find the sample code and schema for GetDBDateTime.zip fil

    Please help me to find the GetDBDateTime.zip and Guest_Book.zip files.
    Tks!

    Does this Help?
    http://www.oracle.com/technology/sample_code/products/ias/files/psp/GetDBDateTime/Readme.html
    Did you install Oracle9iAS ?

  • Finding duplicates within a date range. SQL help please!!

    I have a table of records and I am trying to query the duplicate emails that appear within a given date range but cant figure it out.
    There records that it returns are not all duplicates withing the given date range.  HELP!!
    Here is my query.
    Thanks in advance.
    SELECT cybTrans.email, cybTrans.trans_id, cybTrans.product_number, cybTrans.*
    FROM cybTrans
    WHERE (((cybTrans.email) In (SELECT [email] FROM [cybTrans] As Tmp GROUP BY [email] HAVING Count(*)>1 ))
    AND ((cybTrans.product_number)='27')
    AND ((cybTrans.appsystemtime)>'03-01-2010')
    AND ((cybTrans.appsystemtime)<'03-05-2010')
    ORDER BY cybTrans.email;

    Yet another method...
    <cfset start_date = DateFormat('01/01/2007',
    'mm/dd/yyyy')>
    <cfset end_date = DateFormat('09/30/2009',
    'mm/dd/yyyy')>
    <cfset start_year = DatePart('yyyy', start_date)>
    <cfset end_year = DatePart('yyyy', end_date)>
    <cfset schoolyear_start = '09/01/'>
    <cfset schoolyear_end = '06/30/'>
    <cfset count = 0>
    <cfloop index="rec" from="#start_year#"
    to="#end_year#">
    <cfset tmp_start = DateFormat('#schoolyear_start##rec#',
    'mm/dd/yyyy')>
    <cfset tmp_end = DateFormat('#schoolyear_end##rec + 1#',
    'mm/dd/yyyy')>
    <cfif DateCompare(tmp_start,start_date) gt -1 and
    DateCompare(tmp_end, end_date) eq -1>
    <cfset count = count + 1>
    </cfif>
    </cfloop>
    <cfoutput>
    <br>There are #count# school year periods between
    #start_date# and #end_date#
    </cfoutput>

  • Need Help Please with Flash Professional - No Cursor Change on Buttons/Links in Mac OS

    Hi Folks, I am relatively new to Flash Professional but I recently built a very nice flash website with very little problems.  I noticed after I uploaded my site to my server, that my mouse cursor did not change from an arrow to a finger on any of my buttons.  It did change on the hyperlinks, but not on the buttons.  Everything still worked fine but there was no indication to the user that an object was in fact an interactive button.  I found this code:  button1.buttonMode = true; button1.useHandCursor = true; and inserted it for all my buttons and that seemed to fix everything, I tested the site on firefox, ie, and safari.  I am using a PC with windows 7.  When I went to check the website on a Mac powerbook, the cursor did not change on any of the buttons and it does not change on any of my hyperlinks either.  I have searched all over trying to find a solution and have had no luck.  Can anyone please help me with this problem or point me in the right direction?  Any advice would be very much appreciated.  Thanks so much!!!

    Thank you so much for replying!  I did in fact let flash professional create the HTML page for the site and have not altered it at all.  Would you have any other suggestions as to why it's not displaying my links/buttons on a Mac?  I checked out the browsers Firefox, ie, and safari on my pc, but looking thru safari on the Mac, the cursor does not change on any of my links or buttons.  Thanks again so much for the reply, nice to hear from a human instead of reading thousands of posts!  Very much appreciated!!!!!

  • Maps with 5-digit zip code boundaries

    Hi,
    I am trying to display zip-code level data in a map. Someone suggested that I should take a look at Oracle Application Express.
    I find it meets most of my requirements. But there is one problem - the maps show 3-digit zip-code boundaries of US States.
    However, I want to display data for 5-digit zipcode boundaries. Is there a map available for that?
    Or is there a map application present with which I can integrate Apex to display data at 5-digit zipcode level with the boundaries already marked in the map?
    Appreciate suggestions and assistance.
    Thanks!

    This link may be of some use:
    [url http://anychart.com/products/anymap/converter/help/tutorial.html]AnyChart Map Converter
    Jeff

  • Help Please with Wii

    I have a Mac OSX 10.6.3 and would like to connect my Wii game to it for the purpose of playing iTunes radio stations from the Wii in a different room than the room the Mac is in. I would like to use either Bluetooth or Airport.....or for that fact I guess any way to connect the Wii to my computer wireless to play music.
    Q- Can anyone please help me with how to do this ? What steps do I need to take.
    Thank you for any help.

    There are no "iTunes Radio Stations" as such. If you're referring to the stations listed in the Radio section of iTunes, as I presume you are, those are independent stations being streamed from some other server and do not need iTunes at all. So if your Wii is capable of accessing streaming radio, it should be able to connect to them directly (if the Wii doesn't have a similar list of stations, looking up the station via the web and then finding their direct link should get you going). How to do that would be a question best taken up on a Wii-related web site, as would your question about how to use your Wii with a wireless network.
    Regards.

Maybe you are looking for

  • Error in submiting request set from Daily Business Intelligence Administrat

    I am getting the following error when submitting "ADS Incremental Financials Request Group" request set from "Daily Business Intelligence Administrator" responsibility in vision R12 instance : APP-FND-01564: ORACLE error -1116 in SUBMIT: others Cause

  • Custom invoice blocked due to Quantity.

    Hi All This is regarding Intercompany India scenario. Issue : Custom invoice  #5109581820 has been blocked for quantity. There are seven conditions ( JCDB,JCV1,JECV,J1CV,JEDB,JSDB,JADC) maintained for custom vendor and one condition (ZCCC ) for custo

  • Access Multiple Source Variables in Transform  Activity

    We have a transform activity that fills a complex type from another complex type that is received from a webservice invoke activity. One of the nodes in that destination complex type does not exist in the source complex type. The actual value of that

  • JDev 9.0.3.3 Commit issue when using Transaction DataSource

    Hi, Env: JDev 9.0.3.3/WL 6.0 sp1/Oracle 8i We have successfully deployed our application in 3-tier(remote mode) in JDev 9.0.3.2. using JClient, EO/VO, EJB Session Facade (BMT). Now we are planning to use JDev 9.0.3.3 In JDev 9033 with the same code b

  • Migration of EBS Linux to AIX

    Hi, i am making a migration of EBS 11.5.10 CU2 of Linux to AIX 6.1, and only i have a question about the documentation. The steps are: 1) Generate and upload the manifest of customer-specific files 2) Create the Target System APPL_TOP 3) Clone the Au