I have two simple SQL queries that I have no idea how to optimize
The first one is pretty simple:
SELECT * FROM tags WHERE tag IN (SELECT DISTINCT(tag) FROM tags WHERE datatype = 'post' AND param1 = '9525')
The table has an index on the "tag" column. It easily takes 3 seconds. Can it be optimized in any way?
The other one I think is simple (I just have limited SQL knowledge). My way of implementing it is with a loop:
SQLStr = "SELECT * FROM blogusers WHERE userid = '" & curUserID & "'"
set rstDB = cnnDB.Execute(SQLStr)
Do While Not rstDB.EOF
tmpBlogID = rstDB.Fields("blogid").Value
SQLStr = "UPDATE blogstats SET myself = 'yes' WHERE blogid = '" & tmpBlogID & "' AND IP = '" & ipadr & "'"
Can this be combined to one UPDATE SQL query?