Re: [SQL] SQL request change when upgrade from 7.0.2 to 7.1.3

2001-09-17 Thread Richard NAGY
Josh Berkus a crit : Richard, I'm curious now. What happens if you remove the table qualifications, e.g.: ORDER BY type, nom; -Josh __AGLIO DATABASE SOLUTIONS___ Josh Berkus Complete information technology [EMAIL PROTECTED] and data management solutions (415)

Re: [SQL] SQL request change when upgrade from 7.0.2 to 7.1.3

2001-09-17 Thread Richard NAGY
Andre Schnabel a crit : Hello Richard, I did some testing and after all your query should be ordered right. The test's I have done: Test=# select t.foo1 from testtable t Test-# union Test-# select t.foo2 from testtable t Test-# order by t.foo1; ERROR: Relation 't' does not exist Same

Re: [SQL] SQL request change when upgrade from 7.0.2 to 7.1.3

2001-09-17 Thread Richard NAGY
Tom Lane a crit : Richard NAGY [EMAIL PROTECTED]> writes: > SELECT aes.ent_id, e.type, e.nom, aes.sect_id as voulu, > cvd_new(current_date, e.date_entree, 'new') FROM ass_entrep_sectact aes, > entreprise e WHERE e.id = aes.ent_id and aes.sect_id > 3 and > aes.sect_id > 9 > and aes.sect_id > 1

Re: [SQL] Part 2 of Intentional, or a bug....

2001-09-17 Thread Kovacs Baldvin
After these I use ~= if I need lines with NULLs in both to be selected. Perhaps you should reconsider your data model. You seem to be treating The given column is a date type column, with some records where date is not given. This not given is represented by NULL. I saw it more elegant than

Re: [SQL] Number the lines

2001-09-17 Thread Haller Christoph
Am I right in assuming you were asking for something like SELECT Rownumbering(), ... FROM Table ORDER BY Column ; and expecting a result like 1| ... 2| ... 3| ... ... where Rownumbering() is a PostgreSQL function If this is what you wanted, this is something I want for a long time

[SQL] functions returning

2001-09-17 Thread Tomasz Myrta
Hi I had to write big sql code returning max 10 rows (3 selects 7,10 and 13 joins, mostly equi-joins - too long to include). I tried do solve this in different ways: 1. create view Look at simple test.sql in attachement. Just make psql -f test.sql. I have PostgreSQL 7.1.2. I'm used to C,C++,

Re: [SQL] group by weirdness

2001-09-17 Thread --CELKO--
Would this give you what you want? SELECT j.id, j.created, COUNT(mj.mid), SUM(CASE WHEN ml.state 11 THEN 1 ELSE 0 END) AS tally_1, SUM (CASE WHEN ml.state IN(2,5) THEN 1 ELSE 0 END)AS tally_2 FROM j, mj, ml WHERE j.fkey = 1 AND mj.jid = j.id AND ml.jid = j.id;

Re: [SQL] Number the lines

2001-09-17 Thread Kovacs Baldvin
Hi! I am in the university now, not be able to test what I say, so please forgive me if it is buggy or wrong. So does it helps you?: CREATE SEQUENCE ordering; SELECT NEXTVAL('ordering') as rownumber, * INTO TABLE anewname FROM whatyouwant; Probably CREATE SEQUENCE 'ordering';, do try it...

[SQL] Checking for table existence

2001-09-17 Thread Julester
Hi everyone. In my old SQL Server days, I used a command such as IF exists(select name from sys_objects where name = 'xyztable') to check if a table existed before creating it with a standard CREATE command. I looked in the PostgreSQL documentation, but for the life of me, I can't find an

[SQL] How to see the definition of an existing table?

2001-09-17 Thread ke wang
Is there any command or query to see the definition of an existing table, like which is the primary key, which is not null etc. Thanks! --Ke ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate

Re: [SQL] How to Get Timestamp From SECONDS?

2001-09-17 Thread Hans-Juergen Schoenig
Try it with something like that: mydata=# SELECT '1-1-2001'::timestamp + '200 seconds'::interval; ?column? 2001-01-01 00:03:20+01 (1 row) epoch + seconds = desired timestamp. Hans ---(end of broadcast)---

Re: [SQL] group by weirdness

2001-09-17 Thread Carl van Tast
Joseph, you might want to try: CREATE VIEW mj1 (jid, cnt) AS SELECT jid, COUNT(mid) cnt FROM mj GROUP BY jid; CREATE VIEW ml1 (jid, cnt) AS SELECT jid, COUNT(*) cnt FROM ml WHERE state 11 GROUP BY jid; CREATE VIEW ml2 (jid, cnt) AS SELECT jid, COUNT(*) cnt FROM ml WHERE state IN (2,5) GROUP

Re: [SQL] Checking for table existence

2001-09-17 Thread Roberto Mello
On Fri, Sep 14, 2001 at 06:58:29PM +, Julester wrote: Hi everyone. In my old SQL Server days, I used a command such as IF exists(select name from sys_objects where name = 'xyztable') to check if a table existed before creating it with a standard CREATE command. I looked in the

Re: [SQL] Checking for table existence

2001-09-17 Thread Kovacs Baldvin
Hi everyone. In my old SQL Server days, I used a command such as IF exists(select name from sys_objects where name = 'xyztable') to check if a As far as I know, there is not direct support of this. However, I also would appreciate a builtin qexec(text) procedure, for making queries. Now I

[SQL] I could do with some guidance

2001-09-17 Thread David. E. Goble
Hi All; Trying to set up a database with postgres. below is what I have so far... In the example I want board to be filled with; Secretary|Goble|David|11/05/1970|280198R How do I do this? Also is what I have so far the best way for this database? Later I will want to write an inferface for

Re: [SQL] Checking for table existence

2001-09-17 Thread Josh Berkus
Julester, Hi everyone. In my old SQL Server days, I used a command such as IF exists(select name from sys_objects where name = 'xyztable') to check if a table existed before creating it with a standard CREATE command. I looked in the PostgreSQL documentation, but for the life of me, I