Re: [SQL] disable constraints

2003-02-26 Thread Patrik Kudo
straints: $1 FOREIGN KEY (userid) REFERENCES person(userid) ON UPDATE NO ACTION ON DELETE CASCADE alter table asdf drop constraint "$1"; Regards, Patrik Kudo rute solipa wrote: hello, does anyone nows how can i disable/enable table or column constraints? in oracle it's possib

[SQL] indexing and LIKE

2001-10-11 Thread Patrik Kudo
column index on both id and name? Both id and name are of type "text". TIA, Patrik Kudo ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Re: [SQL] Selecting latest value

2001-09-20 Thread Patrik Kudo
userid, ts DESC; > > See the DISTINCT ON example in the SELECT reference page for more info: > http://www.ca.postgresql.org/users-lounge/docs/7.1/postgres/sql-select.html Thanks! I was trying some stuff with distinct on, but in combination with max(ts), which obviously didn't work.

Re: [SQL] Selecting latest value

2001-09-20 Thread Patrik Kudo
e, the userid-val combinations will be unique, but I want unique userids with only the latest val for each userid. /Patrik Kudo > > > > Hi, > > > > I have a table which basically looks like this: > > > > create table (userid text, val integer, ts timestamp); > >

[SQL] Selecting latest value

2001-09-18 Thread Patrik Kudo
, except for uniqueness on userid). I belive this should be a trivial task, but I'm experience total lack of insight here... Comments? /Patrik Kudo ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] Which SQL query makes it possible to optain the 3 greatest

2001-09-14 Thread Patrik Kudo
ES (12); INSERT INTO T (v) VALUES (3); INSERT INTO T (v) VALUES (9); INSERT INTO T (v) VALUES (4); In that case you could do the following: SELECT v FROM T ORDER BY v DESC LIMIT 3; This will select the values, sort them in descending order and limit the result to 3 rows. I hope it helps. Regar

Re: [SQL] How do I extract ONE particular field, when multiple table

2001-09-14 Thread Patrik Kudo
What you want to know is probably this: Select XID, xi.DENOM, PRICE, FRT, CTID From XItem xi, Category c Where xi.System=1 and xi.Category=c.Index Regards, Patrik Kudo ---(end of broadcast)--- TIP 2: you can get off all lists at once with the

Re: [SQL] C Functions

2001-07-12 Thread Patrik Kudo
I've never used functions in postgres, but the line *resultp = *testo; looks wrong to me. Shouldn't it be strcpy(resultp, testo); ? Regards, Patrik Kudo ech`echo xiun|tr nu oc|sed 'sx\([sx]\)\([xoi]\)xo un\2\1 is xg'`ol Känns det oklart? Fråga på! On Thu, 12 Jul 2001

Re: [SQL] != and <> operators

2001-03-13 Thread Patrik Kudo
How many of the other dbms' out there have this "hardwired hack"? Is something that's postgres-specific, or is it found in oracle and sqlserver too? Regards, Patrik Kudo ech`echo xiun|tr nu oc|sed 'sx\([sx]\)\([xoi]\)xo un\2\1 is xg'`ol Känns det oklart? Fråga på!

[SQL] != and <> operators

2001-03-12 Thread Patrik Kudo
Hi! I've for a while now been using the != operator in my sql queries, but in almost all examples I see <> instead. Are there any good reason to use any instead of the other? I prefer !=, but if you convince me, I'll change to what you other guys are using ;-) Regards, Patri

Re: [SQL] Load or Copy ??

2001-02-07 Thread Patrik Kudo
Hi try COPY forum FROM 'datei.csv' USING DELIMITERS '|'; You should use either 'filename' OR stdin, not both. Hope it helps. Regards, Patrik Kudo -- ech`echo xiun|tr nu oc|sed 'sx\([sx]\)\([xoi]\)xo un\2\1 is xg'`ol Känns det oklart? Fråga på! On

[SQL] Index problem

2000-11-15 Thread Patrik Kudo
#x27;select version()' PostgreSQL 6.5.3 on i386-unknown-freebsd4.1, compiled by cc uname -a FreeBSD 4.1-RELEASE #0: Tue Aug 29 15:31:01 CEST 2000 Regards, Patrik Kudo ech`echo xiun|tr nu oc|sed 'sx\([sx]\)\([xoi]\)xo un\2\1 is xg'`ol Känns det oklart? Fråga på!

Re: [SQL] get table schema in psql?

2000-09-15 Thread Patrik Kudo
Hi! I think what you're looking for is \d and \d name_of_table You might also want to try \? for a list of all psql commands Regards, Patrik Kudo ech`echo xiun|tr nu oc|sed 'sx\([sx]\)\([xoi]\)xo un\2\1 is xg'`ol Känns det oklart? Fråga på! On Fri, 15 Sep 2000, Mich

Re: [SQL] Creating timestamps in queries?

2000-07-11 Thread Patrik Kudo
Hi Rob, Try this: select * from blah where stamp >= now()::date - 7; I think it should work. /Patrik Kudo On Mon, 10 Jul 2000, Rob S. wrote: > Hi all, > > I would like to say, > > "select * from blah where stamp >= 7 days ago" > > ...where the &