Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact


Help with sql query


Help with sql query

Author
Message
ronyjosef
ronyjosef
Forum God
Forum God (581 reputation)Forum God (581 reputation)Forum God (581 reputation)Forum God (581 reputation)Forum God (581 reputation)Forum God (581 reputation)Forum God (581 reputation)Forum God (581 reputation)Forum God (581 reputation)

Group: Forum Members
Posts: 1, Visits: 3
hello friends

I'm running this query on an MDB file from vb.Net,The inner SELECT works fine but when wrapped in the outer SELECT, I get the error "An action query cannot be used as a row source."





select * into NewTable

from

(

SELECT 'Table1' AS [Table], SUM(a) - SUM(b) AS Result FROM table1 union all

SELECT 'Table2' AS [Table], SUM(a) - SUM(b) AS Result FROM table2

)








SELECT "Table1" AS Table, SUM(a) - SUM(b) AS Result FROM table1

UNION

SELECT "Table2", SUM(a) - SUM(b) FROM table2

UNION

SELECT "Table3", SUM(a) - SUM(b) FROM table3



It gives me this output

table | result

-------|--------





I would like to know how do I update the below table "new table" with results column from output table?



name | table | result

------|-------|--------





GO


Similar Topics


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....

















A1VBCode Forums


Search