[SQL] help

2003-06-12 Thread Tony Simbine
hello, I've a query which needs too many time ca. 12-15 sec. how can i get a better perfomance? my table have less than 2300 rows. thanks in advance tony explain select o.id from ioobeject o,dist_vertron v where macro_lid=1123 and (o.id=v.id) and (o.deleted'1') and

Re: [SQL] help

2003-06-12 Thread Josh Berkus
Tony, I've a query which needs too many time ca. 12-15 sec. how can i get a better perfomance? First of all, please take this to the PGSQL-PERFORMANCE list. Second, see this web page: http://techdocs.postgresql.org/guides/SlowQueryPostingGuidelines explain select o.id from ioobeject

[SQL] Help required on update query

2003-06-01 Thread Vikas
Hi Christoph,Could you please let me know the syntax for set newCol=oldCol, (This is reference to your mail pasted below)RegardsVikas Sawant[EMAIL PROTECTED] http://fts.postgresql.org/db/mw/msg.html?mid=1071582 resp. You can rename your old column, create a new column varchar(100), update

[SQL] SQL Help

2003-05-31 Thread C F
Hello, I already tried this same basic question with no response maybe I was too wordy. So here it is simplified what's the best way to write this query? I'm open to using stored procedures, but even thenI don't know how I would conditionally populate a resultset (refcursor). Notice that

Re: [SQL] SQL Help

2003-05-31 Thread Bruno Wolff III
On Fri, May 30, 2003 at 08:47:03 -0700, C F [EMAIL PROTECTED] wrote: Hello, I already tried this same basic question with no response maybe I was too wordy. So here it is simplified what's the best way to write this query? I'm open to using stored procedures, but even then I

Re: [SQL] SQL Help

2003-05-31 Thread Josh Berkus
CF, select (case when column1 = column2 then column3 end) as alias1, (case when column1 = column2 then column4 end) as alias2, (case when column1 = column2 then column5 end) as alias3, (case when column6 = column7 then column8 end) as alias4 from mytable Given the information

Re: [SQL] CASE returning multiple values (was SQL Help)

2003-05-31 Thread Richard Huxton
On Friday 30 May 2003 4:47 pm, C F wrote: Hello, I already tried this same basic question with no response maybe I was too wordy. I think it's more a case of nobody seeing a better way. select (case when column1 = column2 then column3 end) as alias1, (case when column1 = column2

Re: [SQL] SQL Help

2003-05-31 Thread Franco Bruno Borghesi
If your concern is speed, the thing here is that you will have as many records as there are in mytable, most of them (I think) with NULLs for alias1, alias2, alias3 and alias4. This way, there is no condition to filter any record, so postgreSQL will do a sequential scan over the whole table. If

Re: [SQL] CASE returning multiple values (was SQL Help)

2003-05-31 Thread Tom Lane
Richard Huxton [EMAIL PROTECTED] writes: On Friday 30 May 2003 4:47 pm, C F wrote: select (case when column1 = column2 then column3 end) as alias1, (case when column1 = column2 then column4 end) as alias2, (case when column1 = column2 then column5 end) as alias3, (case when column6 = column7

Re: [SQL] CASE returning multiple values (was SQL Help)

2003-05-31 Thread C F
I was afraid someone was going to ask that :) Okay, I'll do my best at explaining where I'm coming from I'm working on a mapping application it is user-configurable. What this means (as it pertains to this disucssion) is that the through a configuration file, the user is able to define the

[SQL] Help with LIKE

2003-03-20 Thread David Olbersen
I have a table with 8,628,633 rows that I'd LIKE to search (ha ha). I have a very simple query: SELECT * FROM tableA WHERE column1 LIKE '%something%'; tableA.column1 has an index on it and the database has been vacuumed recently. My problem is with the output of EXPLAIN:

Re: [SQL] Help on indexing timestamps

2003-03-10 Thread Andre Schubert
On Mon, 10 Mar 2003 10:12:15 +0100 Tomasz Myrta [EMAIL PROTECTED] wrote: Andre Schubert wrote: Hi all, i have a little problem on indexing a table which contains about 4 millions of traffic-data. My problem is, that a want to select all data from a specific month from a specific ip

Re: [SQL] Help on indexing timestamps

2003-03-10 Thread Tom Lane
Andre Schubert [EMAIL PROTECTED] writes: Tom Lane [EMAIL PROTECTED] wrote: Update to 7.3, and that problem will go away. What is the difference between 7.2 and 7.3 related to my problem ? 7.3 is willing to index comparisons to now(), that's what ;-) You may care to study the difference

Re: [SQL] Help with query involving aggregation and joining.

2003-02-24 Thread Rajesh Kumar Mallah
ERROR: SELECT DISTINCT ON expressions must match initial ORDER BY expressions may be gotten over by wrapping the first query result in a subselect. not sure though if its proper. regds mallah. test=# SELECT * from ( SELECT distinct on (a.id) b.id ,courseid,name,submission from course a

Re: [SQL] Help with query involving aggregation and joining.

2003-02-24 Thread Christoph Haller
ERROR: SELECT DISTINCT ON expressions must match initial ORDER BY expressions may be gotten over by wrapping the first query result in a subselect. not sure though if its proper. regds mallah. test=# SELECT * from ( SELECT distinct on (a.id) b.id ,courseid,name,submission from

Re: [SQL] Help with query involving aggregation and joining.

2003-02-23 Thread Josh Berkus
Eddie, My requirements involve several large tables. I have simplied scenario into the follow two fictional tables which describes the same requirements. Keep in mind that a simplified example may not solve your real problem ... Basically I would like to display the latest submission for

Re: [SQL] Help with query involving aggregation and joining.

2003-02-23 Thread Eddie Cheung
Hi, I was very glad to see the replies from you guys this morning. The two suggested SQL queries did not return the expected results, but will help me to explain the problem I am facing further. 1) Josh suggested the following query. (I have made minor changes by adding the table name to each

Re: [SQL] Help with a query for charting

2003-02-02 Thread mallah
you could keep a table with list of all possible days in a month. left join that to the results you get from query below this will return NULL for days where there is no data. NULL could then easily converted to 0 using CASE or COALESCE. regds mallah. I'm trying to do a query to count the

[SQL] help: pgSQL docs and debug

2003-02-02 Thread Vic Cekvenich
I need to write some longer pgSQL stored procedures. Can you help? 1. I am looking for a reference of pgSQL functions, etc.? (I have all the books, they have just a few, I also looked all over the web). If you can post a link, tia. For example, what does the || do in pg SQL with a string? I am

Re: [SQL] help: pgSQL docs and debug

2003-02-02 Thread Tomasz Myrta
Vic Cekvenich wrote: I need to write some longer pgSQL stored procedures. Can you help? 1. I am looking for a reference of pgSQL functions, etc.? (I have all the books, they have just a few, I also looked all over the web). If you can post a link, tia. Start from Chapter 19. PL/pgSQL - SQL

Re: [SQL] Help with a query for charting

2003-02-02 Thread greg
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I'm trying to do a query to count the number of tickets opened on each day of a month. It'll always be from the 1st to the end of the month. ... But it doesn't give me a zero for the days when no tickets were opened The problem is that SQL

[SQL] Help with a query for charting

2003-02-01 Thread Andrew Veitch
I'm trying to do a query to count the number of tickets opened on each day of a month. It'll always be from the 1st to the end of the month. This does it: SELECT TO_CHAR(DATE_TRUNC('day',date_opened),'DD') AS day, COUNT(*) FROM ticket GROUP BY DATE_TRUNC('day', date_opened) WHERE date

Re: [SQL] help: triggers

2003-01-30 Thread Tony Simbine
- Original Message - From: Tony Simbine [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, January 29, 2003 8:29 AM Subject: [SQL] help: triggers hello, I'm trying to update a columm on a table with a trigger but it don't work on PostgreSQL 7.2 (i686-pc-linux-gnu, compiled by GCC 2.96). when

[SQL] help: triggers

2003-01-29 Thread Tony Simbine
hello, I'm trying to update a columm on a table with a trigger but it don't work on PostgreSQL 7.2 (i686-pc-linux-gnu, compiled by GCC 2.96). when I update a row the trigger does nothing. what can I do? thanks in advance tony here is my trigger:

Re: [SQL] help: triggers

2003-01-29 Thread Wei Weng
It would be better if you could provide the source of that trigger and involved table schemas? Wei - Original Message - From: Tony Simbine [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, January 29, 2003 8:29 AM Subject: [SQL] help: triggers hello, I'm trying to update

[SQL] help

2003-01-21 Thread Rudi Starcevic
help ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org

[SQL] Help on (sub)-select

2002-12-20 Thread Gary Stainburn
Hi Folks, I have two tables roster holds the duties to be performed and the number of people required per duty. roster_staff holds the people allocated to perform that duty. I'm trying to create a select that will tally the roster_staff and include it with the roster details. I've managed

Re: [SQL] Help on (sub)-select

2002-12-20 Thread Philip Warner
At 10:21 AM 20/12/2002 +, Gary Stainburn wrote: nymr=# select r.*, s.tally from roster r, nymr-# (select count(*) as tally from roster_staff where nymr(# rsdate = '2002-01-01' and rsgid = 11 and rsgsid = 2) as s nymr-# where rodate = '2002-01-01' and rogid = 11 and rogsid = 2;

Re: [SQL] Help on (sub)-select

2002-12-20 Thread Gary Stainburn
On Friday 20 Dec 2002 10:51 am, Philip Warner wrote: At 10:21 AM 20/12/2002 +, Gary Stainburn wrote: nymr=# select r.*, s.tally from roster r, nymr-# (select count(*) as tally from roster_staff where nymr(# rsdate = '2002-01-01' and rsgid = 11 and rsgsid = 2) as s nymr-# where

Re: [SQL] Help on (sub)-select

2002-12-20 Thread Philip Warner
At 11:48 AM 20/12/2002 +, Gary Stainburn wrote: select r.*, count(*) from roster r, roster_staff s where rsdate = rodate and rsgid = rogid and rsgsid = rogid group by r.* This one came up with a parser error near '*' but I don't understand it enough to debug it. Replace

[SQL] Combining queries while preserving order in SQL - Help!

2002-12-02 Thread Casey Allen Shobe
Hi there, I need to do the following in one SQL query: select field1, field2, field3, field4, field5 from table where field6 5 order by field1 And a totals line which shows the sum for each column. The important part is that I need to preserve the order by of the first query. Is there any

[SQL] help on sql query

2002-11-26 Thread Zuev Dmitry
Suppose you have a table T: -- A B -- 1 '111' 2 '222' -- How do you select A and B of the record with A maximum? The desirable result therefore is (2, '222') The two variants I could grow with are: 1) SELECT A, B

Re: [SQL] help on sql query

2002-11-26 Thread Richard Huxton
On Tuesday 26 Nov 2002 1:14 pm, Zuev Dmitry wrote: Suppose you have a table T: A B 1 '111' 2 '222' How do you select A and B of the record with A maximum? 1) SELECT A, B FROM T ORDER BY A DESC LIMIT 1 2) SELECT A, B FROM T WHERE A IN (SELECT MAX(A) FROM T) What do yo

[SQL] help optimise this ?

2002-11-21 Thread Peter Galbavy
I have a table of image 'instances' where the columns include: md5 char(32),-- the 'original' image md5 key file_md5 char(32) primary key, -- the md5 of each version of an image image_width int, image_length int I want to then find either the largest (max) or smallest (min)

Re: [SQL] help optimise this ?

2002-11-21 Thread Tom Lane
Peter Galbavy [EMAIL PROTECTED] writes: I want to then find either the largest (max) or smallest (min) version of an image that falls within some range of sizes: Depends on how you want to define largest and smallest, but if area is a good enough definition, seems like this would work: select

Re: [SQL] help optimise this ?

2002-11-21 Thread Peter Galbavy
: Thursday, November 21, 2002 3:46 PM Subject: Re: [SQL] help optimise this ? Peter Galbavy [EMAIL PROTECTED] writes: I want to then find either the largest (max) or smallest (min) version of an image that falls within some range of sizes: Depends on how you want to define largest and smallest

Re: [SQL] help!

2002-10-25 Thread Horst Herb
On Wed, 16 Oct 2002 19:15, John Geng wrote: how to migrate sql from MS sql server to postgresql? i'd like to tranfer sql schema from MS server Example: ***1* if exists (select * from sysobjects where id = object_id(N'[admin].[test]') and

Re: [SQL] Help on creating a High Availability PostgreSQL

2002-10-24 Thread Tatsuo Ishii
We are looking to create a two-machine high-availability configuration for PostgreSQL. We have been pursuing using something like rserv, but this appears to be more of a slave sync tool. Actually, this is also important to us (as we expect we will need to scale to lots of readers doing

[SQL] help!

2002-10-18 Thread John Geng
how to migrate sql from MS sql server to postgresql? i'd like to tranfer sql schema from MS serverExample:***1*if exists (select * from sysobjects where id = object_id(N'[admin].[test]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)drop table

[SQL] Help with SQL

2002-10-16 Thread Eric L. Blevins
I'm new to postgres. I've got 2 SQL statements I would like to combine into one. I think I need to use a sub select or join I am not sure. Any help would be appreciated! statement 1: SELECT uid, count(uid) FROM triangulated WHERE uid != 'anonymus' AND uid!= 'anonymous' AND uid != '' GROUP

Re: [SQL] Help with SQL

2002-10-16 Thread Oliver Elphick
On Wed, 2002-10-16 at 19:26, Eric L. Blevins wrote: I've got 2 SQL statements I would like to combine into one. ... statement 1: SELECT uid, count(uid) FROM triangulated WHERE uid != 'anonymus' AND uid != 'anonymous' AND uid != '' GROUP BY uid ORDER BY count DESC LIMIT 10; ... statement 2:

Re: [SQL] Help with SQL

2002-10-16 Thread Eric L. Blevins
|159 (4 rows) Thanks for your help! Eric L. Blevins - Original Message - From: Oliver Elphick [EMAIL PROTECTED] To: Eric L. Blevins [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, October 16, 2002 4:38 PM Subject: Re: [SQL] Help with SQL On Wed, 2002-10-16 at 19:26, Eric L

[SQL] Need some SQL help

2002-10-07 Thread Brian Ward
I have a table id int statusint create_dt datetime When users log in and out I insert a row into this table throughout the day. I'm trying though to come up with a querie to tell me and ordering of users as they report in in the morning so i'm trying to say select each user and the

Re: [SQL] Need some SQL help

2002-10-07 Thread Dan Langille
On Sun, 6 Oct 2002, Brian Ward wrote: I have a table id int statusint create_dt datetime When users log in and out I insert a row into this table throughout the day. I'm trying though to come up with a querie to tell me and ordering of users as they report in in the morning

Re: [SQL] HELP w/ SQL -- distinct select with non distinct fields?

2002-09-27 Thread John Gilson
RVL [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I'm work with Sybase on the Sun... and, being a clueles newbee in SQL department, hope you could help. I have a set of data: acct name qty link date memo 101 item_A 100 0001 9/2/02 blah 101

[SQL] HELP w/ SQL -- distinct select with non distinct fields?

2002-09-27 Thread RVL
I'm work with Sybase on the Sun... and, being a clueles newbee in SQL department, hope you could help. I have a set of data: acct name qty link date memo 101 item_A 100 0001 9/2/02 blah 101 item_A 250 0001 9/3/02 n/a 101 item_A80 0002 9/3/02 n/a 101 item_B90

[SQL] Help tuning query

2002-09-27 Thread Kevin Traub
All; Can anyone please help with the tuning of this query? With 77000 rows in the operator_messages database the query is taking almost 15 seconds to return. Preference woul dbe under 5 seconds if possible. System load on a dual processor P3 with 1.5GB of memory remains under .4 during the

Re: [SQL] Help tuning query

2002-09-26 Thread Dmitry Tkach
First of all, try replacing the username/foldername indexes on operator_messages with a single combined index on, say (username,foldername)... It is still not clear to me why it decides not to use one of those indexes you have (it would be less efficient than a combined index, but still better

Re: [SQL] help w/ constructing a SELECT

2002-09-20 Thread Josh Berkus
Charles, 3. All contigs where all clones have read = 'x' SELECT * FROM contigs WHERE NOT EXISTS ( SELECT contig_id FROM clones WHERE clones.contig_id = contigs.contig_id AND read 'x'); i.e. Select all contigs not having any clone whose read is something other than 'x' got

[SQL] help w/ constructing a SELECT

2002-09-19 Thread Charles Hauser
Greetings, Having a problem with a query. I would like to construct a query which will return a list of all contigs which are comprised of clones whose 'read' = 'x' (read can be either 'x' or 'y'). Details: A contig may be comprised of more than 1 clone, so in TABLE clone_contig, there

Re: [SQL] help w/ constructing a SELECT

2002-09-19 Thread Josh Berkus
Charles, Having a problem with a query. I would like to construct a query which will return a list of all contigs which are comprised of clones whose 'read' = 'x' (read can be either 'x' or 'y'). It appears that you haven't formulated clearly what you want to get. I can see 3

[SQL] Help needed

2002-08-28 Thread Mowat, Paul
Dear postgresql, I am just starting to learn SQL. I have attached a script that allows me to create some tables and indexes. I have rows that are inserted into the tables. Ineedsomehelpwithcreatingmultiplesubqueriesandtablejoins,(sixorseventablejoins). Can you help? Paul Mowat Software QA

[SQL] Help with function optimisation

2002-07-10 Thread Ian Cass
Hi, I've got a function that I run as a trigger to update a summary table on insert to the main table. As you can see below, it does a select an INSERT if not found, or an UPDATE if found. This currently works OK, but I'd like to improve performance by removing the SELECT attempting an UPDATE.

Re: [SQL] Help with function optimisation

2002-07-10 Thread Tom Lane
Ian Cass [EMAIL PROTECTED] writes: I've got a function that I run as a trigger to update a summary table on insert to the main table. As you can see below, it does a select an INSERT if not found, or an UPDATE if found. This currently works OK, but I'd like to improve performance by removing

[SQL] Help with a recursive query

2002-06-19 Thread Jerome Alet
Hi, I've got a table like this : idparent description 0100 xx 0200 xx 0301 xx 0402 xx 0501 xx 0605 xx 0703 xx 0807

[SQL] HELP: Trend reporting

2001-08-30 Thread Jason Charette
Hello newsgroup buddies, I am looking for information on trend reporting. We run Linux, PostreSQL, Apache and PHP4. We have a series of scripts that track customer usage through our sites, and give us similar information to what is found in the Apache logs, but with more data. I now find myself

[SQL] Help On Postgresql

2001-08-30 Thread Jaydip
Dear Friends I am Jaydip Dewanji working as a Sr. Programmer for Ontrack Systems Ltd. I have some questions regarding Postgresql which are listed below: a) How do I retrieve the Year,Month,Day,Hr,Minute or Second value from a Date/DateTime variable. For Example : i In Oracle

Re: [SQL] Help On Postgresql

2001-08-30 Thread Jeff Eckermann
a) Look at "Date/Time Functions" in the docs: specifically, listed under "Functions and Operators" in the Users Guide. b) "Serial" type will do this. Look under "Numeric Types" , in the "Data Types" section of the Users Guide. - Original Message - From: Jaydip To: [EMAIL

Re: [SQL] Help On Postgresql

2001-08-30 Thread Stephan Szabo
On Thu, 23 Aug 2001, Jaydip wrote: a) How do I retrieve the Year,Month,Day,Hr,Minute or Second value from a Date/DateTime variable. For Example : i In Oracle to_char(dt,'') - for extracting the year value from a date variable dt ii In SqlServer datepart(hh,dt) -

Re: [SQL] Help with SQL statement - Thanks

2001-07-16 Thread James Orr
SELECT * FROM Payments P1 WHERE Date = (SELECT MAX(Date) FROM Payments P2 WHERE P2.CustomerNo = P1.CustomerNo) I think that will do it. - James - Original Message - From: Henry [EMAIL PROTECTED] To: [EMAIL PROTECTED]@postgresql.org Sent: Saturday, July 14, 2001 3:16 PM Subject: [SQL

[SQL] Help! Failure of pgdump -a

2001-07-10 Thread Josh Berkus
Folks, In an effort to do some general cleanup in my database functions, I dumped the schema (pgdump -s) and the data (pgdump -a) to seperate text files. I editied and restored the schema fine. However, when I attemped to restore the data (via \i filename), it failed selectively; some tables

[SQL] Help with a double left join

2001-06-22 Thread Ari Nepon
I am trying to do a left join FROM [a table with two columns that have foreign IDs] LEFT JOIN [two other tables, each has a unique ID]. I have the left join working where I join only two tables (not three): !--current SQL-- SELECT track.ID, track.employee, track.client, track.task,

RE: [SQL] Help with a double left join

2001-06-22 Thread Ari Nepon
]] Sent: Friday, June 22, 2001 9:42 AM To: Ari Nepon Cc: Pgsql-Sql Subject: Re: [SQL] Help with a double left join On Wed, 20 Jun 2001, Ari Nepon wrote: I am trying to do a left join FROM [a table with two columns that have foreign IDs] LEFT JOIN [two other tables, each has a unique ID]. I

Re: [SQL] Help with a double left join

2001-06-22 Thread Tom Lane
Ari Nepon [EMAIL PROTECTED] writes: Thanks Alex. But it was too good to be true. Or, more likely, I did something else wrong. clients.ID = client.ID, likely. regression=# create table track(project int, client int); CREATE regression=# create table project(project_id int); CREATE regression=#

[SQL] Help datetime

2001-06-12 Thread Tubagus Nizomi
i have problem in datetime my_table (start_date datetime,stop_date datetime); insert into my_table values ('Sun May 13 16:19:27 2001 JAVT','Sun May 13 14:06:13 2001 JAVT') select stop_date-start_date from my_table the result is @ 2 hours 13 mins 14 secs but i want result in minutes(integer)

[SQL] Help with ECPG on debian Potato

2001-05-22 Thread BOUCHPAN-LERUST-JUERY Lionel
Hi, I am running Debian GNU/Linux potato and I have a problem with ECPG: when I type the example provided in the PostgreSQL book: http://www.ca.postgresql.org/docs/aw_pgsql_book/node149.html I type : piou@yoda:~/BD$ ecpg truc.pgc and I have the following error : Error: Cannot open include file

[SQL] Help! Record logging

2001-05-18 Thread Edwin S. Ramirez
Hello, I would like to setup a trigger to keep track of all changes done onto the records of paticular tables. Basically, there would be two identical tables such as, 'medications' and 'medications_log', when a user inserts, updates or deletes a record I would like a copy to be inserted

[SQL] HELP: what's wrong with my PL/PSQL function??

2001-05-18 Thread Bruno Boettcher
hello! i have the following function: CREATE FUNCTION plusSum(text,int4) RETURNS int4 AS ' DECLARE jrlname ALIAS FOR $1; sumup ALIAS FOR $2; actsum int4; arow RECORD; conversion float8; temp float8; sum float8; BEGIN sum := 0; RAISE NOTICE ''stats % '', sumup; FOR arow IN

Re: [SQL] HELP : Can't load JDBC driver !

2001-04-22 Thread Josh Berkus
Nusa, I suggest that you take your question to the pgsql-jdbc list, a list specifically for JDBC interfacing with Postgres. See www.postgresql.org for directions on how to subscribe. -Josh __AGLIO DATABASE

[SQL] HELP : Can't load JDBC driver !

2001-04-22 Thread nusa
Hi, Yes, I cant't load the JDBC driver !!! There must be a silly set-up somewhere, but I can't find it. Here some informations that might help you : 1. Mandake 7.2 2. the postmaster is run from init script as follow : su -l postgres -c /usr/bin/pg_ctl -D $PGDATA -o '-i' -p

[SQL] help

2001-04-07 Thread Loïc Bourgeois
I read your document about the porting from Oracle to PgSql and I would like to know if you can say to me if there is an equivalent on an the option NOWAIT for a request SELECT ... FOR UPDATE (for Oracle) under PgSql. This option don't wait a previus unlock and return the information like the

[SQL] Help with 'now', now(), timestamp 'now', ...

2001-03-30 Thread edipoelder
Hi all, I´m developing some procedures in my db and i want know how much time my procedures take to execute. So, i write my first procedure (to test) as follows: CREATE FUNCTION TEST(INTEGER) RETURNS INTEGER AS ' DECLARE SEQ RECORD; BEGIN SELECT

[SQL] Help with 'now', now(), timestamp 'now', ...

2001-03-30 Thread Daniel Wickstrom
"edipoelder" == edipoelder [EMAIL PROTECTED] writes: edipoelder times. Then I changed the function and run, at id = edipoelder 14. Change again at id = 15. Where is underlined edipoelder (), i tried to put, 'now', timestamp 'now', etc, edipoelder and always get the

[SQL] Help

2001-03-26 Thread Mohamed ebrahim
Hi, Thanks for your valuable information. I tried the cron. i typed cron -e and entereed into the input area. but i don't know how to save the cron file. I pressed ctrl+z and came out from cron. but i edit the cron file i found nothing on it.(i.e using pico filename.) Please tell me some

Re: [SQL] Help

2001-03-26 Thread selkovjr
Instead of "ctrl+z", press ":wq" (colon for command mode, w for write, q for quit). If you are still mystified, "ctrl+z" stops a process running on a terminal, so it's likely that your vi is still running idle. Type 'fg' on the same terminal to bring it back. For more details on job control,

[SQL] Help

2001-03-25 Thread Mohamed ebrahim
Hi, I am a user of postgresql. I want to know that it is possible to call a jsp file in postgre command.Please help me to know how to call a jsp file. Thank you Ebrahim __ Do You Yahoo!? Get email at your own domain with Yahoo! Mail.

[SQL] Help

2001-03-25 Thread Mohamed ebrahim
Hi, I am a user postgresql. I want to update a table automatically when we reach monthend. i.e i want to update some table on 31 of every month automatically without any user attention. I want to know how to do this. If anyone knows how to do this please mail me. i will be ever thankfull to

Re: [SQL] Help

2001-03-25 Thread Joe Conway
I am a user postgresql. I want to update a table automatically when we reach monthend. i.e i want to update some table on 31 of every month automatically without any user attention. I want to know how to do this. If anyone knows how to do this please mail me. i will be ever thankfull to

Re: [SQL] Help

2001-03-25 Thread Richard Huxton
From: "Mohamed ebrahim" [EMAIL PROTECTED] Hi, I am a user postgresql. I want to update a table automatically when we reach monthend. i.e i want to update some table on 31 of every month automatically without any user attention. I want to know how to do this. If anyone knows how to do

Re: [SQL] Help with UPDATE syntax

2001-03-15 Thread Tom Lane
Jeff Putsch [EMAIL PROTECTED] writes: update user_group_map map Postgres doesn't allow UPDATE to use an alias for the target table (SQL92 doesn't either). Get rid of the alias name "map", and write the full table name "user_group_map" in the places where "map" is used in the

[SQL] help

2001-03-12 Thread chard
help me pls. i got an error like this when i do an insert to a table, my table dont have bpchar type of field. ERROR: Unable to identify an operator '=' for types 'bpchar' and 'varchar' You will have to retype this query using an explicit cast ---(end of

Re: [SQL] help

2001-03-12 Thread Stephan Szabo
What is the schema of the table in question, does it have any references to other tables and what is an example insert statement? On Wed, 7 Mar 2001, chard wrote: help me pls. i got an error like this when i do an insert to a table, my table dont have bpchar type of field. ERROR:

Re: [SQL] help

2001-03-12 Thread Tom Lane
chard [EMAIL PROTECTED] writes: i got an error like this when i do an insert to a table, my table dont have bpchar type of field. ERROR: Unable to identify an operator '=' for types 'bpchar' and 'varchar' You will have to retype this query using an explicit cast it seems 1 field in

Re: [SQL] Help creating rules/triggers/functions

2001-03-03 Thread Jan Wieck
Blaise Carrupt wrote: Hi all ! I use PostgreSQL 7.0.2 on a HP-UX system. I would like to create a simple function and a simple trigger (or rule) that deny a delete from a table if the row is referenced in another table. I though it should look like this (from my Ingres experience... :) :

[SQL] Help creating rules/triggers/functions

2001-03-02 Thread Blaise Carrupt
Hi all ! I use PostgreSQL 7.0.2 on a HP-UX system. I would like to create a simple function and a simple trigger (or rule) that deny a delete from a table if the row is referenced in another table. I though it should look like this (from my Ingres experience... :) : create function

[SQL] Help needed - ERROR: record arow has no field description

2001-03-02 Thread Justin Clift
Hi all, I'm getting this error, which to me makes no sense. Running PostgreSQL 7.0.3 on Mandrake 7.2 (compiled from source, not the rpms). The code is in a pl/pgsql function I am writing and I can't see why it's complaining. This is the appropriate part of the code : general CREATE type

RE: [SQL] Help creating rules/triggers/functions

2001-03-02 Thread Sondaar Roelof
a_del(45); a_del --- 45 (1 row) dhcp=# SELECT a_del(1); ERROR: not allowed ! I hope this helps. Best regrards, Roelof -Original Message- From: Blaise Carrupt [SMTP:[EMAIL PROTECTED]] Sent: 27 February 2001 17:43 To: [EMAIL PROTECTED] Subject: [SQL] Help creating

Re: [SQL] Help creating rules/triggers/functions

2001-03-02 Thread Stephan Szabo
If you're only doing a simple check for reference, why not use foreign keys? In general however, you probably want to use plpgsql to define the trigger. And trigger functions don't take parameters in the normal sense, the function should be created taking no args and returning opaque; the

[SQL] HELP: m$ access - psql howto ?

2001-02-23 Thread Jaume Teixi
Hi, I cannot use any kind of odbc because my customers have his local m$ access db's locally then export them on .txt with tab or | separated, then put on my server trought ftp. and is working ok except that the customers are on spanish databases then a data like:

[SQL] Help Retrieving Latest Record

2001-02-16 Thread Steve Meynell
Hi, I am not sure if this went through the first time so here it is again. Ok what I am trying to do is select out of the database the latest record meeting a certain criteria. Example: Number | Fruit | Date 15 Apples July 20, 1999 20 Oranges June 7, 2000 13 Pears Jan 31, 2000 17 Apples April

[SQL] Help retrieving lastest record

2001-02-16 Thread Steve Meynell
Ok what I am trying to do is select out of the database the latest record meeting a certain criteria. Example: Number | Fruit | Date 15 Apples July 20, 1999 20 Oranges June 7, 2000 13 Pears Jan 31, 2000 17 Apples April 10, 1999 Now what I need to do is select the oranges out because the date is

Re: [SQL] Help Retrieving Latest Record

2001-02-16 Thread Dorin Grunberg
It would be something like: select * from basket where Date=(SELECT max(Date) from basket); At 09:41 AM 2/16/2001 -0500, Steve Meynell wrote: Hi, I am not sure if this went through the first time so here it is again. Ok what I am trying to do is select out of the database the latest record

Re: [SQL] Help Retrieving Latest Record

2001-02-16 Thread Michael Fork
SELECT * FROM basket ORDER BY date desc LIMIT 1; and SELECT * FROM basket WHERE fruit = 'apple' ORDER BY date desc LIMIT 1; Michael Fork - CCNA - MCP - A+ Network Support - Toledo Internet Access - Toledo Ohio On Fri, 16 Feb 2001, Steve Meynell wrote: Hi, I am not sure if this went through

Re: [SQL] Help retrieving lastest record

2001-02-16 Thread Andrew Perrin
How 'bout these: fgdata=# select * from fruit order by dt desc limit 1; number | fruit | dt +-+ 20 | Oranges | 2000-06-07 00:00:00-05 (1 row) fgdata=# select * from fruit where fruit='Apples' order by dt desc limit 1; number

Re: [SQL] Help Retrieving Latest Record

2001-02-16 Thread Tom Lane
Steve Meynell [EMAIL PROTECTED] writes: select * from basket where max(date) and fruit='Apples'; I know this doesn't work but I need something like it. Perhaps select * from basket where fruit='Apples' order by date desc limit 1; The limit clause is

Re: [SQL] Help Retrieving Latest Record

2001-02-16 Thread Jie Liang
Subquery will do: select * from basket where Date in (select max(Date) from basket); Jie LIANG St. Bernard Software Internet Products Inc. 10350 Science Center Drive Suite 100, San Diego, CA 92121 Office:(858)320-4873 [EMAIL PROTECTED] www.stbernard.com www.ipinc.com On Fri, 16 Feb 2001,

Re: [SQL] HELP: Scarey pl/pgsql problem

2001-02-05 Thread Tom Lane
Justin Clift [EMAIL PROTECTED] writes: I'm having trouble with what MAY BE a bug in PL/PGSQL for PG 7.0.3 on Linux (Mandrake Linux 7.2). [ bogus roundoff behavior in date/time display ] This is a known silliness in the Mandrake distribution: their default compiler flags include both -O3 and

Re: [SQL] SQL Help

2001-01-29 Thread Mark A. Summers
I am loser -- I didn't realize there was analyze option on vacuum -- I created another index on Publisher code -- Now it smokes thanks Mark Summers "Stephan Szabo" [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Fri, 26 Jan 2001, Mark A. Summers wrote: I

Re: [SQL] SQL Help

2001-01-26 Thread Stephan Szabo
On Fri, 26 Jan 2001, Mark A. Summers wrote: I am having trouble with the following query taking forever: - SELECT * FROM ret108108_00, product WHERE ret108108_00."isbn" = product."Item1" AND product."SuperCategory" = '1' AND product."PublisherCode" = 'ZON' ORDER BY

[SQL] help with query

2001-01-24 Thread Oleg Bartunov
Hi, I have a table messages which has (for simplicity) two columns - msg_id, last_id, where last_id is sort of symbolical link - it points to the msg_id of the last version of message. There are no limitation to the number of versions. The problem I have is to get history of message with given

<    1   2   3   4   5   >