On Mar 11, 2006, at 16:46 , Michael Glaesemann wrote:
select t1.id as t1_id, t2.id as t2_id
from test t1
join test t2 on (t1.a = t2.b and t1.b = t2.a)
where t1.a < t2.a;
t1_id | t2_id
---+---
4 | 7
1 | 2
(2 rows)
Just a follow-up (mostly to myself): I've been toying
Hi All.!
I just want to know one thing that is it possible with PGSQL that,
if I want to insert and execute a query from a external text file instead of giving it at the pgsql prompt?
just like in Oracle the file having query is executed with a '@ filename' statement at the sql prompt..
AKHILESH GUPTA <[EMAIL PROTECTED]> schrieb:
> Hi All.!
> I just want to know one thing that is it possible with PGSQL that,
> if I want to insert and execute a query from a external text file instead of
> giving it at the pgsql prompt?
in psql, try simple "\i your_file.sql" to execute the
inside psql, type :
\i filename
On Sat, 11 Mar 2006 11:29:20 +0100, AKHILESH GUPTA
<[EMAIL PROTECTED]> wrote:
Hi All.!
I just want to know one thing that is it possible with PGSQL that,
if I want to insert and execute a query from a external text file
instead of
giving it at t
Is it possible to use SQL to merge data into one result?
A theorethical example to explain:
tbl_test (
id integer,
information varchar(25))
id | information
---+--
1 | Yo
2 | Go away
1 | Stay put
3 | Greetings
Please note id is not unique and not a primary key.
and I wonder
Jesper K. Pedersen <[EMAIL PROTECTED]> schrieb:
> Is it possible to use SQL to merge data into one result?
>
> A theorethical example to explain:
>
> tbl_test (
> id integer,
> information varchar(25))
>
> id | information
> ---+--
> 1 | Yo
> 2 | Go away
> 1 | Stay put
> 3 |
Hi,
On Mar 11 05:31, Jesper K. Pedersen wrote:
> Is it possible to use SQL to merge data into one result?
test=# SELECT id, info FROM concat_t;
id | info
+--
1 | A
2 | B
1 | AA
3 | C
1 | D
1 | DD
(6 rows)
test=# SELECT array_to_string(ARRAY(SELECT info FROM concat_t WHERE i
On Sat, 11 Mar 2006 17:43:37 +0100
Andreas Kretschmer <[EMAIL PROTECTED]> wrote:
> Jesper K. Pedersen <[EMAIL PROTECTED]> schrieb:
>
> > Is it possible to use SQL to merge data into one result?
> >
> > A theorethical example to explain:
> >
> > tbl_test (
> > id integer,
> > information var
Centuries ago, Nostradamus foresaw when [EMAIL PROTECTED] ("Jesper K.
Pedersen") would write:
> Is it possible to use SQL to merge data into one result?
>
> A theorethical example to explain:
>
> tbl_test (
> id integer,
> information varchar(25))
>
> id | information
> ---+--
> 1
Hi,
I need a special aggregation function. For instance, given the following
table data:
aid| cat | weight
--+-+-
a1 | Drama | 1
a1 | Romance | 6
a1 | Short | 1
a1 | Other | 7
a2 | Comedy | 1
a2 | Drama | 2
a3
Weimao Ke wrote:
Hi,
I need a special aggregation function. For instance, given the
following table data:
aid| cat | weight
--+-+-
a1 | Drama | 1
a1 | Romance | 6
a1 | Short | 1
a1 | Other | 7
a2 | Comedy | 1
a2 | Dram
On Sun, Mar 12, 2006 at 12:09:48AM -0500, Weimao Ke wrote:
> I want to group by "aid" and choose the category (i.e., "cat") with the
> largest "weight":
>
> aid | max_weighted_cat
> +-
> a1 | Other
> a2 | Drama
> a3 | Adult
PostgreSQL has a non-standard DI
On Sun, Mar 12, 2006 at 12:34:57AM -0500, Jeffrey Melloy wrote:
> Should be able to do this with a standard max() aggregate.
>
> select aid, cat, max(weight)
> from table
> group by aid, cat;
That query returns the maximum weight for each (aid, cat) pair.
Against the example data it returns the e
13 matches
Mail list logo