Re: [SQL] I, nead to capture the IP number from the PC how is running the script ...

2010-03-16 Thread Niklas Johansson
the address of the remote connection. Sincerely, Niklas Johansson -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] Design and Question

2008-07-10 Thread Niklas Johansson
the queries with real data. Sincerely, Niklas Johansson -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] Need some magic with alternative rows

2008-06-08 Thread Niklas Johansson
.group_nr=m1.group_nr AND fk 0)); Sincerely, Niklas Johansson -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] Substract queries

2008-05-22 Thread Niklas Johansson
table in both cases, just do: SELECT * FROM mytable WHERE condition1 AND NOT condition2 Otherwise, use EXCEPT: SELECT * FROM mytable1 WHERE condition1 EXCEPT SELECT * FROM mytable2 WHERE condition2 in which case both queries must return the same type of rows. Sincerely, Niklas Johansson

Re: [SQL] inhibit rounding on numeric columns

2008-02-14 Thread Niklas Johansson
scale is not the equivalent of character string length. What is the actual problem you're trying to solve? Sincerely, Niklas Johansson ---(end of broadcast)--- TIP 7: You can help support the PostgreSQL project by donating at http

Re: [SQL] Concatenation through SQL

2007-12-21 Thread Niklas Johansson
On 21 dec 2007, at 12.16, Leif B. Kristensen wrote: I've got a similar problem. My persons table has a number of fields for different name parts: given, patronym, toponym, surname, occupation, epithet. I'd like something more elegant, like the Python or PHP join() function. I tried

Re: [SQL] Group by minute

2006-09-22 Thread Niklas Johansson
try GROUP BY date_trunc('minute', quando) or even GROUP BY EXTRACT(EPOCH FROM quando)::integer / 60 Sincerely, Niklas Johansson ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [SQL] nested select within a DISCTINCT block

2006-09-14 Thread Niklas Johansson
in most cases. Sincerely, Niklas Johansson ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL]

2006-08-10 Thread Niklas Johansson
? An obvious source of ambiguity is the date comparison: tb1.field5 BETWEEN '03/07/2006' AND '03/08/2006' Is that interval a day or a month (mm/dd/ or dd/mm/)? Check your datestyle setting and make sure all systems interpret the date correctly (or at least the same). Sincerely, Niklas

Re: [SQL] Table constraints and INSERT

2006-05-17 Thread Niklas Johansson
to a float or numeric, try: SELECT 9 + 999::numeric/10 + 999::numeric/100; In your case: CHECK (P_RETAILPRICE = (9 + P_PARTKEY::numeric / 10 + P_PARTKEY::numeric / 100) Sincerely, Niklas Johansson Phone: +46-322-108 18 Mobile: +46-708-55 86 90 ---(end

Re: [SQL] SELECT composite type

2006-04-05 Thread Niklas Johansson
, 26910), 4326) AS foo, sightings.title FROM sightings WHERE sighting_id = 25) bar; Sincerely, Niklas Johansson ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [SQL] Ugly group by problem

2006-03-29 Thread Niklas Johansson
OR REPLACE FUNCTION feat_group(INTEGER) RETURNS INTEGER[] AS $$ SELECT ARRAY(SELECT DISTINCT feat_id FROM linktest WHERE link_id=$1 ORDER BY feat_id); $$ LANGUAGE sql STABLE; SELECT feat_group(link_id), SUM(other) FROM linktext t1 GROUP BY 1; Sincerely, Niklas Johansson

Re: [SQL] Help writing a piece of SQL

2006-02-03 Thread Niklas Johansson
=t1.domain); Sincerely, Niklas Johansson ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [SQL] Help writing a piece of SQL

2006-02-03 Thread Niklas Johansson
username FROM users WHERE username='fred' and domain=t1.domain), username); Sincerely, Niklas Johansson ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster