SELECT * FROM Banners WHERE BannerID = #BannerID# ORDER BY BannerID SELECT * FROM tblStats WHERE BannerID = #BannerID# and associateid=#associateid# and clickdatetime = '#dateFormat('#now()#','mm/dd/yyyy')#' ORDER BY BannerID SELECT * FROM tblStats WHERE bannerid = #bannerid# and associateid=#associateid# and clickdatetime = '#dateFormat('#now()#','mm/dd/yyyy')#' UPDATE tblStats Set clickthrus = #add# where BannerID = #BannerID# and associateid=#id# and clickdatetime = '#dateFormat('#now()#','mm/dd/yyyy')#' INSERT INTO tblSTATS (BannerID, REFER, clickdatetime,associateid,Clickthrus,affiliateid) VALUES (#BannerID#,'#ReferSite#','#dateFormat('#now()#','mm/dd/yyyy')#',#associateid#,1,#affiliateid#) UPDATE tblstats set impressions = #add1# where bannerid = #bannerid# and associateid=#associateid# and clickdatetime = '#dateFormat('#now()#','mm/dd/yyyy')#' SELECT imageurl from banners where bannerid = #bannerid# and associateid=#associateid#