Re: [GENERAL] GROUP BY hour

2008-08-01 Thread Osvaldo Rosario Kussama
Nathan Thatcher escreveu: I have, what I imagine to be, a fairly simple question. I have a query that produces output for a line graph. Each row represents an interval on the graph. SELECT COUNT(call_id) AS value, EXTRACT(hour from start_time) AS hour FROM c_call WHERE start_time >= '2008-08-01

Re: [GENERAL] percentile rank query

2008-04-10 Thread Osvaldo Rosario Kussama
William Temperley escreveu: Hi all I'm trying to calculate the percentile rank for a record based on a 'score' column, e.g. a column of integers such as: 23,77,88,23,23,23,12,12,12,13,13,13 without using a stored procedure. So, select count(*) as frequency, score from scoretable group by score

Re: [GENERAL] Most Occurring Value

2008-04-08 Thread Osvaldo Rosario Kussama
Volkan YAZICI escreveu: Mike Ginsburg <[EMAIL PROTECTED]> writes: There is probably a really simple solution for this problem, but for the life of me I can't see to think of it. I have three tables --contains u/p for all users in the site TABLE users (user_id INT primary key, username VARCHAR(

Re: [GENERAL] SELECT DISTINCT ON and ORDER BY

2008-03-28 Thread Osvaldo Rosario Kussama
josep porres escreveu: maybe this? select value, max(id) as id, max(order_field) as order_field from mytable group by value order by 3 Wrong. For the op data you will obtain tuples not in original relation. bdteste=# SELECT * FROM foo; id | value | order_field +---+-

Re: [GENERAL] Filter tables

2007-11-12 Thread Osvaldo Rosario Kussama
Reg Me Please escreveu: Il Monday 12 November 2007 17:05:18 Dimitri Fontaine ha scritto: Hi, Le lundi 12 novembre 2007, Reg Me Please a écrit : What I'd need to do is to "filter" t1 against f1 to get only the rows ( 'field1',1 ) and ( 'field2',1 ). select * from t1 natural join f1 where t1.id

Re: [GENERAL] Generating sql to capture fully qualified table names???

2007-10-19 Thread Osvaldo Rosario Kussama
smiley2211 escreveu: Hello all, I am using the query below to generate SQL code to grant access to objects - how do I get this statement to PULL the fully qualified name (schema.tablename)??? * SELECT 'GRANT SELECT, INSERT, UPDATE, DELETE ON ' || relname || ' TO newuser

Re: [GENERAL] Cannot declare record members NOT NULL

2007-09-12 Thread Osvaldo Rosario Kussama
Cultural Sublimation escreveu: Hi, I am not sure if this qualifies as a bug report or a feature request, but I don't see any way to tell Postgresql that the members of a record cannot be NULL. This causes all kinds of problems when this record is used to declare the return type of a function.

Re: [GENERAL] Is there a better way to do this?

2007-08-28 Thread Osvaldo Rosario Kussama
Wei Weng escreveu: Hi all I want to implement something like the following: CREATE OR REPLACE FUNCTION AddDays (TIMESTAMP WITHOUT TIME ZONE , INT) RETURNS TIMESTAMP WITHOUT TIME ZONE AS ' DECLARE time ALIAS FOR $1; days ALIAS FOR $2; BEGIN RETURN time+days*24*

Re: [GENERAL] [PROPOSAL] DML value format

2007-08-13 Thread Osvaldo Rosario Kussama
Alejandro Torras escreveu: -- English -- Hi, Is there some way to put values in a INSERT statement without taking care of apostrophes? In example: INSERT INTO persons VALUES ('Harry', 'O'Callaghan'); ^^^ I think that it can be used some kind of len

Re: [GENERAL] Checking for a number

2007-06-27 Thread Osvaldo Rosario Kussama
Warren escreveu: I need to check if the last two characters of a field are a number. I am trying something like this but it does not want to work. substring(TRIM(field8) from '..$') SIMILAR TO '\d\d' How should I do this? Try: SELECT your_field ~ '.*[[:digit:]]{2}$'; Osvaldo

Re: [GENERAL] Postgre Sql 7.3 connection problem

2007-05-07 Thread Osvaldo Rosario Kussama
A. Kretschmer escreveu: am Mon, dem 07.05.2007, um 0:39:43 -0700 mailte nij es folgendes: sir, I am using postgresql 7.3 in Redhat Linux.Windows XP is my client. I want to communicate pgsql without a specific ip rangeI.I want to accept all ip address in postgresql 7.3. How can i comunicate. P

Re: [GENERAL] Populate a calendar table

2007-03-27 Thread Osvaldo Rosario Kussama
Raymond O'Donnell escreveu: 'Lo all, I've created a calendar table based on an article I found on the web, but I can't figure out what's wrong with the query I've written to populate it. Here's the table - CREATE TABLE aux_dates ( the_date date NOT NULL, the_year smallint NOT NULL, the