Re: [GENERAL] primary key and existing unique fields

2004-10-26 Thread Duane Lee - EGOVX
Title: RE: [GENERAL] primary key and existing unique fields Look at the database design in terms of data retrieval.  If I add a sequence number as my primary key, when I get ready to retrieve that record "directly" how do I know what that sequence number is.  For instance, my employee number i

Re: [GENERAL] primary key and existing unique fields

2004-10-26 Thread Duane Lee - EGOVX
Title: RE: [GENERAL] primary key and existing unique fields Since you already have the unique field I see no point in adding a sequence to the table, unless of course the sequence of the data inserts is of importance at some point. Duane -Original Message- From: Sally Sally [mailto:

Re: [GENERAL] combining two queries?

2004-10-22 Thread Duane Lee - EGOVX
Title: RE: [GENERAL] combining two queries? Try select a.name,count(*) from xenons as a, viewer_movies as b where a.id = b.viewerid group by a.name order by a.name; -Original Message- From: Mark Harrison [mailto:[EMAIL PROTECTED]] Sent: Friday, October 22, 2004 4:55 PM To: [EMAIL

Re: [GENERAL] postgres book

2004-09-14 Thread Duane Lee - EGOVX
Title: RE: [GENERAL] postgres book I like the book.  It covers up to 7.2 but don't let that bother you it still has plenty of appropriate information crammed inside. Duane -Original Message- From: Greg Donald [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 14, 2004 2:37 PM To: p

Re: [GENERAL] Spacing in output

2004-09-14 Thread Duane Lee - EGOVX
Title: RE: [GENERAL] Spacing in output What is the field size of prod_name?  You could use SUBSTR(prod_name,1,xx) where xx is the max number of characters you want to see. Duane -Original Message- From: Jerome Lyles [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 14, 2004 2:06 P

Re: [GENERAL] performance of IN (subquery)

2004-08-27 Thread Duane Lee - EGOVX
Title: RE: [GENERAL] performance of IN (subquery) Have you thought about using existence checking:  WHERE EXISTS (SELECT '1' FROM FOO2 WHERE BAZ = BAZ2) If the index exists on BAZ2 you might get away with a quick index only check. Duane -Original Message- From: Kevin Murphy [mail

Re: [GENERAL] Wanted: Want to hide data by using PL/PGSQL functio

2004-07-21 Thread Duane Lee - EGOVX
Title: RE: [GENERAL] Wanted: Want to hide data by using PL/PGSQL functions This sounds like a perfect situation to use a view.  With the view you can limit the data that can be seen by the user. Duane -Original Message- From: Gellert, Andre [mailto:[EMAIL PROTECTED]] Sent: Wednesd

Re: [GENERAL] Formatting Function..

2004-07-06 Thread Duane Lee - EGOVX
Title: RE: [GENERAL] Formatting Function.. You could always use SUBSTR(Name,x,y) AS xxx to control the size of the output and the heading. Duane -Original Message- From: Vinay Jain [mailto:[EMAIL PROTECTED]] Sent: Sunday, July 04, 2004 10:20 PM To: [EMAIL PROTECTED] Subject: [GENER

Re: [GENERAL] INSERT ON DUPLICATE KEY UPDATE

2004-06-18 Thread Duane Lee - EGOVX
ssage- From: Richard Huxton [mailto:[EMAIL PROTECTED]] Sent: Friday, June 18, 2004 11:02 AM To: Eduardo Pérez Ureta Cc: Duane Lee - EGOVX; [EMAIL PROTECTED] Subject: Re: [GENERAL] INSERT ON DUPLICATE KEY UPDATE Eduardo Pérez Ureta wrote: > On 2004-06-18 17:19:40 UTC, Duane Lee - EGOVX wrote

Re: [GENERAL] INSERT ON DUPLICATE KEY UPDATE

2004-06-18 Thread Duane Lee - EGOVX
Title: RE: [GENERAL] INSERT ON DUPLICATE KEY UPDATE I would suspect you would need to write a trigger to do this. -Original Message- From: Eduardo Pérez Ureta [mailto:[EMAIL PROTECTED]] Sent: Friday, June 18, 2004 9:38 AM To: [EMAIL PROTECTED] Subject: [GENERAL] INSERT ON DUPLICATE K

Re: [GENERAL] virtual fields on VIEW?

2004-06-18 Thread Duane Lee - EGOVX
Title: RE: [GENERAL] virtual fields on VIEW? If I understand you correctly I believe this will work for you. create view as select         t1.id, t1.date, t1.field1, t1.field2,         t2.fieldA, t2.fieldB, --      state, stuff     case   when t

Re: [GENERAL] Keep history of modifications

2004-06-14 Thread Duane Lee - EGOVX
Title: RE: [GENERAL] Keep history of modifications Write an audit trigger to insert the required data into a table.  I'm doing that myself for a table holding budget ledger data and will be creating the same concept for other tables. Duane -Original Message- From: Daniel Devico [mai

[GENERAL] Help in finding the error

2004-06-08 Thread Duane Lee - EGOVX
Title: Help in finding the error I'm trying to insert data into an empty table but I keep getting the error: ERROR: could not open relation with OID 42939 I have a couple of constraints on the table but what I'm entering doesn't violate those.  Can someone tell me where in the system catal

Re: [GENERAL] How to find out who is calling the function

2004-06-07 Thread Duane Lee - EGOVX
Why not use CURRENT_USER? -Original Message-From: BARTKO Zoltan [mailto:[EMAIL PROTECTED]Sent: Friday, June 04, 2004 10:34 PMTo: [EMAIL PROTECTED]Subject: [GENERAL] How to find out who is calling the function Dear friends,   I had a look at www.pgsql.ru, looking for ho

Re: [GENERAL] TimeOf(Subselects|Joins)FromLargeTables?

2004-06-04 Thread Duane Lee - EGOVX
Title: RE: [GENERAL] TimeOf(Subselects|Joins)FromLargeTables? Or this correlated subquery: SELECT a.name, a.seq FROM prots as a WHERE EXISTS ( SELECT '1'FROM kwx as b WHERE b.kw_acc=812   and b.fid = a.fid ); -Original Message- From: Dann Corbit [mailto:[EMAIL PROTECTED]] Sent: Thu

[GENERAL] Trigger & Function

2004-06-01 Thread Duane Lee - EGOVX
Title: Trigger & Function I'm trying to create a trigger (AFTER INSERT, UPDATE, DELETE) as an audit routine inserting into an audit table the "before" and "after" views of the row being acted upon.  My problem is I defined the "before" and "after" fields in the audit table as TEXT and when I t

Re: [GENERAL] multiple count functions in a select statement

2004-06-01 Thread Duane Lee - EGOVX
If I understand what you're asking try:   select count_1, count_2 from (select count(*) AS count_1 from leads where ad_code = '555'), (select count(*) AS count_2 from leads where ad_code = '222') ;   Duane -Original Message-From: Jeannie Stevenson [mailto:[EMAIL PROTECTED]Se

Re: [GENERAL] multiple count functions in a select statement

2004-06-01 Thread Duane Lee - EGOVX
Sent a little too quickly the sql should look like this:   select count_1, count_2 from (select count(*) AS count_1 from leads where ad_code = '555') AS DMY1, (select count(*) AS count_2 from leads where ad_code = '222') AS DMY2 ; -Original Message-----Fro