Sammenskrivning af 2 SQL linier
HejNogle som kan hjælpe med mig at sammenskrive disse til én SQL linie?
Set rsListe= Conn.Execute("SELECT * FROM budget_katid2postid INNER JOIN budget_varekat ON budget_varekat.varekat_id = budget_katid2postid.katid INNER JOIN budget_post ON budget_post.post_id = budget_katid2postid.postid WHERE budget_post.post_budgetid = " & strBudgetID & " AND budget_katid2postid.budgetid = " & strBudgetID & " AND budget_varekat.varekat_budgetid = " & strBudgetID & " AND month(budget_post.post_dato) = " & strMaaned & " AND year(budget_post.post_dato) = " & strAar & " GROUP BY budget_katid2postid.katid")
if rsListe.eof or rsListe.bof then
else
Do While Not rsListe.EOF
Set rsBelob= Conn.Execute("SELECT SUM(budget_post.post_pris) AS ialt FROM budget_post INNER JOIN budget_katid2postid ON budget_post.post_id = budget_katid2postid.postid WHERE budget_katid2postid.budgetid = " & strBudgetID & " AND budget_post.post_budgetid = " & strBudgetID & " AND budget_katid2postid.katid = " & rsListe("varekat_id") & " AND month(budget_post.post_dato) = " & strMaaned & " AND year(budget_post.post_dato) = " & strAar & " ")