Re: [SQL] C/C++ interface

2001-02-16 Thread dev
>> Original Message << On 2/16/01, 8:24:09 AM, Volker Paul <[EMAIL PROTECTED]> wrote regarding Re: [SQL] C/C++ interface: > Tom Lane wrote: > > > > Volker Paul <[EMAIL PROTECTED]> writes: > > > Is someone maintaining the C++ interface and its documentation? >

[SQL] PL/PgSQL FOR syntax

2001-02-16 Thread Roberto Mello
Hi, What's the correct syntax to access rows in a FOR loop? I'm writing a PL/PgSQL doc and seem to be making a mistake somewhere. I am referring to this: [<>] FOR record | row IN select_clause LOOP statements END LOOP; How do I access the

[SQL] Re: Trigger question

2001-02-16 Thread Dan McGrath
Actually, a default of now() would be perfectly providing you created a rule to trap insert's and updates and remove the setting for that time/date from being inserted so as to have the db use the dfault which I think is far easier that making a silly trigger for something so simple. Dan Dave We

[SQL] Data Types

2001-02-16 Thread David Olbersen
Hello. I have a table in which I'm trying to store the length of a sound file. I decided to use the TIME data type. Was this correct? One of the operations I want to do is sum() all of my files lengths to get the total amount in terms of time, of sound that I have. I notice that sum() doesn't ta

Re: [SQL] problem with casting

2001-02-16 Thread Gighen Daisuku
In data Wed, 14 Feb 2001 21:10:30 + (UTC), postgresql scrive: >I have a table that has a 'date' column. In psql I tried to do a > >select proofdate::text from openjobs where jobno = '10625'; > >responce:   can not cast type 'date' to 'text' > >Did i miss-read this section. I thought I could c

Re: [SQL] Data Types

2001-02-16 Thread Josh Berkus
David, > However this gives me output that I don't know how to read: '7 02:34:27' > Does that read as 7 Days, 2 Hours, 34 Minutes and 27 seconds? Yes. -Josh Berkus -- __AGLIO DATABASE SOLUTIONS___ Josh Berkus Complete inf

[SQL] Suggestions on finetuning this search?

2001-02-16 Thread Justin Long
I would welcome any suggestions for fine-tuning this search to run faster. Here is the SQL. Basically what we're allowing people to do is to specify words to search our article index. THE TABLES: knowledge = the knowledge base of articles kb_categories = the category that each article is assign

[SQL] Datetime Query

2001-02-16 Thread Mark Byerley
I need to create a query which will select a request_no between Data1 and Date2 so... SELECT request_no FROM request where status_code ='C' and (completed_date between 01/01/2000 and 01/01/2001); The problem I have run into is that the completed_date field is a datetime format (not by my own

[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

[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 

Re: [SQL] Help retrieving lastest record

2001-02-16 Thread Alex Pilosov
Get an SQL book. select * from basket where date=(select max(date) where fruit='Apples) and fruit='Apples'; On Thu, 15 Feb 2001, Steve Meynell wrote: > Ok what I am trying to do is select out of the database the latest > record meeting a certain criteria. > > Example: > > Number

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 rec

Re: [SQL] Help Retrieving Latest Record

2001-02-16 Thread Roberto Mello
On Fri, Feb 16, 2001 at 09:41:09AM -0500, Steve Meynell wrote: > > I know this doesn't work but I need something like it. > or something like > > select * from basket where max(date) and fruit='Apples'; > This would yield me: > 15Apples July 20, 1999

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 t

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] Datetime Query

2001-02-16 Thread Jie Liang
Try: SELECT request_no FROM request where status_code ='C' and (completed_date::date between '01/01/2000'::date and '01/01/2001'::date) actually date('01/01/2000') does same thing as '01/01/2000'::date Jie LIANG St. Bernard Software Internet Products Inc. 10350 Science Center Drive Suite 10

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, St

Re: [SQL] PL/PgSQL FOR syntax

2001-02-16 Thread Jie Liang
Yes, e.g. declare r record; begin for r in select statement loop r.fieldname can fetch the result from the select statment row by row 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.