Re: [SQL] SQL Date Challenge

2001-06-04 Thread Josh Berkus
Since so many people responded to my initial question, I thought I'd post my procedural solution using PL/pgSQL (permission granted to Roberto to acquire it). I'm not gonna even try to explain the various references to my database structure; there are too many. This is all from StaffOS, which

Re: [SQL] Huh? Data typing bug?

2001-06-04 Thread Josh Berkus
Tom, > IIRC, number of days (as an int) is what that's supposed to produce. > > If that's not what you wanted, maybe you ought to cast the dates to > timestamp or some such. I see. It was never made clear to me that here the DATE type differs from DATETIME and TIMESTAMP significantly. This

Re: [SQL] Huh? Data typing bug?

2001-06-04 Thread Tom Lane
"Josh Berkus" <[EMAIL PROTECTED]> writes: > I just subtracted two dates and got an INT4, rather than the INTERVAL I > was expecting. What goes on here? IIRC, number of days (as an int) is what that's supposed to produce. If that's not what you wanted, maybe you ought to cast the dates to

Re: [SQL] Huh? Data typing bug?

2001-06-04 Thread Grant
You got difference in seconds as the result? Show some examples. ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://www.postgresql.org/search.mpl

[SQL] Huh? Data typing bug?

2001-06-04 Thread Josh Berkus
Folks, I just subtracted two dates and got an INT4, rather than the INTERVAL I was expecting. What goes on here? -Josh __AGLIO DATABASE SOLUTIONS___ Josh Berkus Complete information technology [EMAIL PROTECTED]

Re: [SQL] SQL Date Challenge

2001-06-04 Thread Josh Berkus
Peter, Alex, > You can't easily build data out of nothing in a declarative way in > SQL. > Basically, if you want a list of data you either need to put them in > a > table (which you don't want) or list them in the command itself > (which you > can't). This isn't made easier by the fact that fun

Re: [SQL] SQL Date Challenge

2001-06-04 Thread Josh Berkus
Folks, Thanks for your suggestions. Apparently I wasn't clear enough about what I'm trying to do: > > > > SELECT ALL Wednesdays BETWEEN 5/1/01 AND 6/1/01; > > > > somthing like: > > select date from xx where to_char(date,'fmdy') = 'wed'; This doesn't solve my problem, as th

Re: [SQL] SQL Date Challenge

2001-06-04 Thread Manuel Sugawara
"Josh Berkus" <[EMAIL PROTECTED]> writes: > > SELECT ALL Wednesdays BETWEEN 5/1/01 AND 6/1/01; > somthing like: select date from xx where to_char(date,'fmdy') = 'wed'; hth, Manuel. ---(end of broadcast)--- TIP 1: subscribe and unsubscribe comm

Re: [SQL] PGAccess/pgplsql Blues

2001-06-04 Thread Josh Berkus
Roberto, > IIRC, pgaccess does quote-escaping for you, so if you try to write > "standard" PL/pgSQL (escaping single quotes), it'll barf this error. > > Just something to check. Thanks. This doesn't seem to be the case; it seems to be a translation problem: 1. Test fn_save_order: it's work

[SQL] SQL Date Challenge

2001-06-04 Thread Josh Berkus
Folks, Can anyone come up with a purely declarative (i.e. SQL) way to SELECT all of the Wednesdays within a given time period? Or is there, perhaps, some trick of the PGSQL date parser I could use? I can think of a number of ways to do this procedurally, but that's very awkward