Re: [SQL] Sending function parametars within EXECUTE ''SELECT...

2005-09-29 Thread Mario Splivalo
On Thu, 2005-09-29 at 16:36 +1000, Stewart Ben (RBAU/EQS4) * wrote: > > Is there a way to assing variable a value returned from query that > > accesses the temporary table in a way you explained above? > > > > For instance, I can do: > > > > myValue := col2 FROM tmpTbl WHERE someValue = something

Re: [SQL] Selecting count of details along with details columns

2005-09-29 Thread Richard Huxton
Axel Rau wrote: SELECT T2.T2_name, COUNT(T1.id) AS xx FROM T2, T1 WHERE T2.id = T1.fk_t2 GROUP BY T2.T2_name HAVING COUNT(T1.id) > 1 ORDER BY xx DESC; t2_name | xx -+ T2-N2 | 3 T2-N3 | 2 (2 rows) Adding column t1_name to the result set breaks COUNT(T1.i

Re: [SQL] Selecting count of details along with details columns

2005-09-29 Thread Axel Rau
Am 29.09.2005 um 10:30 schrieb Richard Huxton: Axel Rau wrote: SELECT T2.T2_name, COUNT(T1.id) AS xx FROM T2, T1 WHERE T2.id = T1.fk_t2 GROUP BY T2.T2_name HAVING COUNT(T1.id) > 1 ORDER BY xx DESC; t2_name | xx -+ T2-N2 | 3 T2-N3 | 2 (2 rows) Adding column t1_name to the result

Re: [SQL] Selecting count of details along with details columns

2005-09-29 Thread Richard Huxton
Axel Rau wrote: Am 29.09.2005 um 10:30 schrieb Richard Huxton: Axel Rau wrote: SELECT T2.T2_name, COUNT(T1.id) AS xx FROM T2, T1 WHERE T2.id = T1.fk_t2 GROUP BY T2.T2_name HAVING COUNT(T1.id) > 1 ORDER BY xx DESC; t2_name | xx -+ T2-N2 | 3 T2-N3 | 2 (

[SQL] EXECUTE with SELECT INTO variable, or alternatives

2005-09-29 Thread Mario Splivalo
I can assign a value to a variable in several ways: myVar := (SELECT col FROM table WHERE somecondition...) myVar := col FROM table WHERE somecondtition... SELECT col INTO myVar FROM table WHERE somecondition How do I do any of the above using EXECUTE? I need to be able to assign the value to a v

Re: [SQL] Selecting count of details along with details columns

2005-09-29 Thread Axel Rau
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Am 29.09.2005 um 12:03 schrieb Richard Huxton: Axel Rau wrote: Am 29.09.2005 um 10:30 schrieb Richard Huxton: Axel Rau wrote: ... Ah - this is two questions: 1. What are the unique (t2_name,t1_name) pairings? 2. How many different (t1.id) va

Re: [SQL] Selecting count of details along with details columns

2005-09-29 Thread Scott Marlowe
On Thu, 2005-09-29 at 14:08, Axel Rau wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > Exactly, that query works as I expected. Thank you. > Can you answer this question as well: > > Looking for a workaround, I learned that aggregate functions are not > > allowed in WHERE clauses. > > Q

[SQL] unsubscribe

2005-09-29 Thread Ricky Sutanto
Please unsubscribe me