Here is what I am trying to do:
I have two select queries that return 3 fields each. I am trying to put together those 3 fields into an insert query.
Here is the query:
INSERT INTO test (a,b,c,d,e,f) VALUES ((SELECT AVG(one), AVG(two), AVG(three) FROM cdr WHERE field1 = phnum)(SELECT AVG(four), AVG(five), AVG(six) FROM cdr WHERE field2 = phnum));
This line is a part of a stored procedure loop so phnum will be dynamic. How can I get this to work? Please help. Thanks