estoy realizando me parece demasiadas consultas y conexiones, cuando creo que se podria simplificar a una sola. Aqui mi ejemplo:
Código:
Alguien sabe como mejorar esto?<% Set Conn = Server.CreateObject("ADODB.Connection") Conn.open "tablero", "sa", "" set rs = CreateObject("ADODB.Recordset") set rs2 = CreateObject("ADODB.Recordset") set rs3 = CreateObject("ADODB.Recordset") set rs4 = CreateObject("ADODB.Recordset") %> <% Dim SQL SQL = "SELECT sum(cub) as parolaccia FROM costos_maxirest WHERE local <= 4 AND month(fecha) = " & month(date()) &" AND year(fecha) = " & year(date()) &" or local >= 7 AND month(fecha) = " & month(date()) &" AND year(fecha) = " & year(date()) &"" set rs = conn.execute(SQL) %> <% Dim SQL2 SQL2 = "SELECT sum(cub) as bistecca FROM costos_maxirest WHERE local = 5 AND month(fecha) = " & month(date()) &" AND year(fecha) = " & year(date()) &" or local = 6 AND month(fecha) = " & month(date()) &" AND year(fecha) = " & year(date()) &"" set rs2 = conn.execute(SQL2) %> <% Dim SQL3 SQL3 = "SELECT sum(cub) as total FROM costos_maxirest WHERE month(fecha) = " & month(date()) &" AND year(fecha) = " & year(date()) &"" set rs3 = conn.execute(SQL3) %> <% Dim SQL4 SQL4 = "SELECT MAX(fecha) as fecha2 FROM costos_maxirest WHERE month(fecha) = " & month(date()) &" AND year(fecha) = " & year(date()) &"" set rs4 = conn.execute(SQL4) %>
Muchas gracias a todos!