Partick,
> Ahhhhhhhh. Thank you Josh. I just learned something new. I've been
> doing
> it this way in MS SQL for years.
Different Procedural SQL implementation, different syntax.
Transact-SQL:
variable assignment:
SELECT @fig=col1, @mike=col2
FROM table1 WHERE col3 = 'a'
temp table creation:
SELECT col1, col2 INTO temp_1
FROM table1 WHRE col3 = 'a'
PL/pgSQL:
variable assignment:
SELECT col1, col2 INTO v_fig, v_mike
FROM table1 WHERE col3='a';
temp table creation
CREATE TEMPORARY TABLE temp_1 AS
SELECT col1, col2 FROM table1
WHERE col3='a';
BTW, in either language you want to minimize your creation of temporary
tables in procedures -- they are much slower than variables or even
very complex queries.
-Josh Berkus