Re: [SQL] if else query help

2000-10-12 Thread John McKown
On Thu, 12 Oct 2000, Jean-Christophe Boggio wrote: > portion of the day (although I don't know --yet-- how to convert > date2-date1 to an integer, trunc does not work). reltime(date2-date1)::int Will subtract date1 from date2, then cast it to an integer. John

Re: [SQL] -query sql

2000-10-09 Thread John McKown
On Tue, 3 Oct 2000, Nema, Vivek wrote: > Hi! >a small query may be u can help me. > i just wanted to compare 2 columns in 2 tables.how can i do it in sql > statement.i know it is possible somehow i am not able to write my query. > i am using RDB 6.0 > > Any pointer or help will be highly ap

Re: [SQL] sum of agreggates in one SELECT?

2000-09-19 Thread John McKown
Well, it's not a single SELECT, but why not use something like: SELECT MAX(b.lot) AS quanity, max(p.price) AS price, p.login INTO TEMPORARY TABLE temp1 FROM bid b, person p WHERE b.auction_id=84 AND p.id=b.person_id GROUP BY p.login ORDER BY max(price); SELECT SUM(quanity) from temp1; If you n

Re: [SQL] Week of the Year?

2000-09-03 Thread John McKown
On Sun, 3 Sep 2000, Brian C. Doyle wrote: > John, > > Would you have any clue how to figure out the first saturday of any month - > 6 days and the last saturday of that month? > > I know that this seems odd but i have to run reports for "Non Standard > Months" and well I am clueless. > > At

Re: [SQL] Select subset of rows

2000-08-27 Thread John McKown
On Sun, 27 Aug 2000, Stephan Szabo wrote: > > Of course immediately after sending the last message and logging off my > ISP I figured out the simpler way for the third one: > > begin; > select salary into temp saltemp from employee order by salary desc > limit 5; > select name from employee w

Re: [SQL] Operator Precedence problem?

2000-08-12 Thread John McKown
Every language that I've ever used (other than APL) has the precedence of "or" being less than "and". So I would always expect the "and" clauses to be evaluated first, then the "or". Just like in math, where in an equation, I expect that the multiplication (and) is done before the addition (or). U

Re: [SQL] Week of the Year?

2000-08-12 Thread John McKown
; > > and the above +6 to the the last day of the week. Another approach for > > this same question is much simplier (if the question is indeed what you > > are asking) > > > > select now()-date_part('dow',now()); > > > > This last select

Re: [SQL] Week of the Year?

2000-08-11 Thread John McKown
ct now()-date_part('dow',now()); This last select gives the Sunday for the current week. To get the Saturday, simply: select now()-date_part('dow',now())+6; Of course, replace the now() with whatever contains the date or timestamp. John McKown > I'm probably staring

Re: [SQL] Extracting data by months

2000-08-03 Thread John McKown
This might seem rather silly, but could you simply do something like: select * from database where date_field >= '01/01/2000'::date and date_field < '02/01/2000'::date; Of course, if date_field could contain many different years, then this would not get you the result you wanted.

Re: [SQL] Transactions

2000-07-28 Thread John McKown
On Fri, 28 Jul 2000, Carolyn Lu Wong wrote: > Does postgreSQL support nested transactions? > no.

[SQL] Re: Simple search question

2000-06-20 Thread John McKown
a new tuple, the attribute defined as SERIAL actually got the value of 1000. Curious, but nice. John McKown (note - not! Jack, but John)

[SQL] Re: Simple search question

2000-06-13 Thread John McKown
On Tue, 13 Jun 2000 12:15:17 +1000, Alex <[EMAIL PROTECTED]> wrote: [snip] > >> so I can't test this. If it doesn't work, I'd try using pg_GetLastOid() >> to get the OID of the inserted row. The use the pg_Exec and SELECT >> * WHERE OID=oid-value, followed by pg_fetch_row(). > >Thanks John

[SQL] Re: Simple search question

2000-06-12 Thread John McKown
On Tue, 13 Jun 2000 09:42:01 +1000, Alex <[EMAIL PROTECTED]> wrote: ]>Hi, ]> after running a script which performs an insert, a new tuple is ]>created, and a serial number is generated for it. I want to write the ]>new tuple data back to the screen, including the new serial number. ]> My question