I'm having a bit of a brain freeze and can't seem to come up with
decent SQL for the following problem:
I have a table "t" of the form "time_occurred TIMESTAMP, prog_data
VARCHAR" and would like to create a query that outputs something of
the form "first_seen, last_seen, count, prog_data".
I hav
I would suggest:selectmax(time_occurred) AS last_seen,min(time_occurred) AS first_seen,count(*),prog_datafrom tgroup by
prog_dataI would also suggest you use inner joins rather than put all your tables in the from and join in the where clause. It is much easier to read and understand what you are
At 10:55 AM 6/21/06, Worky Workerson wrote:
I'm having a bit of a brain freeze and can't seem to come up with
decent SQL for the following problem:
I have a table "t" of the form "time_occurred TIMESTAMP, prog_data
VARCHAR" and would like to create a query that outputs something of
the form "fi
Hi!
I'm using PostgreSQL 7.4.7.
table_c
id | nick
+--
1 | T
2 | S
3 | G
4 | A
5 | D
...
table_m
id | c
--+
22192 | 4
15041 | 3
21764 | 5
22192 | 1
15041 | 4
15041 | 2
...
where table_m.c is a foreign key on table_c.id
SELECT t
On Wed, 21 Jun 2006, Ben K. wrote:
Just for the sake of alternatives -
create sequence cy30 maxvalue 30 cycle;
insert into log values(select generate_series(1,30), 'dummy');
INSERT 0 30
update log set des='' where account_id=(select nextval('cy30'));
UPDATE 1
There are details to consid
At 11:06 AM 6/21/06, [EMAIL PROTECTED] wrote:
returns:
id | nick
--+--
22192 | A
22192 | T
(2 rows)
I'd like to get the result in only one row:
id | nick
--+--
22192 | A,T
This question is in the archives (probably more than once). The answer is...
Read the online docs
> >I'd like to get the result in only one row:
> >id | nick
> >--+--
> >22192 | A,T
> This question is in the archives (probably more than once). The answer
> is...>
> Read the online docs about aggregate functions. There is an example that
> does (almost) exactly what you are aski
At 02:24 PM 6/21/06, Richard Broersma Jr wrote:
> >I'd like to get the result in only one row:
> >id | nick
> >--+--
> >22192 | A,T
> This question is in the archives (probably more than once). The answer
is...>
> Read the online docs about aggregate functions. There is an exampl
I am having brain freeze right now and was hoping someone could help me
with a (fairly) simple query.
I need to join on the next row in a similar table with specific criteria.
I have a table with events per employee.
I need to have a query that gives per employee each event and the event
after
Hi,
I have a table which contains starttime, endtime and
DOW; i.e. a weekly list of times for when a process
must be started and ended.
TABLE: cronTimes
FIELDS: starttime, endtime, dayOfWeek
I have another table which contains date ranges.
TABLE: dateRanges
FIELDS: dateStart, dateEnd
I need to
hi,
iam a novice in postgresql. i want to insert a values to a table using stored procedure. plz mail me the sample codes and examples. thanks in advance
with regards,
Sathaa
I need to write a function which inserts a log entry in a log table and only
keeps the last 30 records. I was thinking of using a subquery similar to the
following:
insert into log (account_id, message) values (1, 'this is a test);
delete from log where account_id = 1 and id not in ( select id
what about putting a limit of 1 on your select statement, so you will just get the first event greater then the initial date for the employee?On 6/18/06, Sim Zacks
<[EMAIL PROTECTED]> wrote:I am having brain freeze right now and was hoping someone could help me
with a (fairly) simple query.I need
13 matches
Mail list logo