Declare variable mysql I am new to mysql, I have been using SQL in the past. I am trying to insert rows into a table via creating a loop. But struggling with it. Any help?

DECLARE @minid  INT = (SELECT MIN(Product_ID) FROM    
    Product_Report_Offer_Interaction_Jan_2012 pn)
DECLARE @maxid  INT = (SELECT max(Product_ID) FROM 
    Product_Report_Offer_Interaction_Jan_2012 pn)

DECLARE @topid INT= @minid + 50000
BEGIN

WHILE ( @minid &lt; @maxid ) 
    BEGIN
        insert into  Product_Report_Offer_Jan_2012 (Month, Product_ID, Offerview, 
        EnlargeImage, DynamicPopUp, ShareonFacebook, BuyNowPress, Sendtofriend,
        Printed, StoreLocated, uLike, iPhoneOfferDetails, iPhoneStoreLocated, 
        WishlistAd, Tweet, Catalogue1pageview, Catalogue2pageview, SearchListing,
        Featured, RelatedAdImpression, Wishlist)
        select pn.Month, pn.Product_ID, pn.Offerview, pn.EnlargeImage, 
        pn.DynamicPopUp, pn.ShareonFacebook, pn.BuyNowPress, pn.Sendtofriend,       
        pn.Printed, pn.StoreLocated, pn.uLike, pn.iPhoneOfferDetails, 
        pn.iPhoneStoreLocated, pn.WishlistAd, pn.Tweet, pm.Catalogue1pageview,
        pm.Catalogue2pageview, pm.SearchListing, pm.Featured,       
        pm.RelatedAdImpression,     
        pm.Wishlist
        -- select count(*)
        -- select *  
        from Product_Report_Offer_Interaction_Jan_2012 pn
            left join Product_Report_Offer_Impression_Jan_2012 pm on pn.product_ID = pm.product_ID 
            where pn.product_id != '0'
                and pn.Product_ID BETWEEN @minid AND @topid

        SET @minid = @minid + 50000 + 1
        SET @topid = @topid + 50000 + 1

  END
END


Thanks jakub
User-defined session-scope variables, beginning with @ are not declared and are loosely and implicitly typed.  Change DECLARE to SET and drop the INT after the variable name if these are the variables you intend to use.

Program variables are declared and typed, and do not start with @.

http://dev.mysql.com/doc/refman/5.6/en/user-variables.html
http://dev.mysql.com/doc/refman/5.6/en/stored-program-variables.html