SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot jsk137's Avatar
    Join Date
    Jan 2002
    Posts
    151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    convert this SQL statement to MySQL

    Hello,

    Can someone help me out by converting this SQL statement to by used in MySQL.

    Code:
     CREATE PROCEDURE zip_nearby_locations 
    @lat1 float, 
    @long1 float,
    @radius float
    AS 
    SELECT (2*3956*ASIN( 
    (SQRT( POWER(SIN(((rlat-@lat1))/2),2) + COS(@lat1) * COS(rlat) 
    				  * POWER(SIN(((abs(rlong)-@long1))/2),2) )) ) 
    ) AS dist, location, zipcode
    FROM Zipcodes 
    WHERE (2*3956*ASIN( 
    (SQRT( POWER(SIN(((rlat-@lat1))/2),2) + COS(@lat1) * COS(rlat) 
    				  * POWER(SIN(((abs(rlong)-@long1))/2),2) )) ) 
    ) < @radius
    ORDER BY dist
    GO
    Thanks for your help.

    Jeff

  2. #2
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    MySQL doesn't support stored procedures. Other than that, the queries look MySQL-compatible.

    [this should be in the Database forum btw - you'll probably get more (and better) replies there ]


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •