Re: [SQL] ORDER BY handling mixed integer and varchar values

2005-05-16 Thread Edmund Bacon
orting on numeric values that are in the same column?? Tia. ---(end of broadcast)------- TIP 8: explain analyze is your friend -- Edmund Bacon <[EMAIL PROTECTED]> ---(end of broadcast)--- TIP 9: the planner will ignore y

Re: [SQL] Self-referencing table question

2005-03-24 Thread Edmund Bacon
your case?) has it's own temporary table space, so you shouldn't have to worry about that. Thanks again, Sean -- Edmund Bacon <[EMAIL PROTECTED]> ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

Re: [SQL] Self-referencing table question

2005-03-24 Thread Edmund Bacon
tput (at least md5sum thinks they are the same). One thing to be aware of is the size of your returned data set - If it's fairly large, then the transfer time from your web-server to the pgsql box might overwhelm any "small" optimization in query time. Sean On Mar 24, 2005, at 11

Re: [SQL] Self-referencing table question

2005-03-24 Thread Edmund Bacon
from_id ; I think PG should be smart enough nowadays to figure out these two queries are basically the same. -- Edmund Bacon <[EMAIL PROTECTED]> ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate sub

[SQL] Conver bool to text

2005-03-11 Thread Edmund Bacon
either SELECT true::text ERROR: cannot cast type boolean to text and to_char() doesn't know about booleans. It's not that difficult to write a fuction to convert boolean to text, but I'm wondering if there's already something that does this? -- Edmund Bacon <[EMAI

Re: [SQL] Comments on subquery performance

2005-02-23 Thread Edmund Bacon
___ Take advantage of powerful junk e-mail filters built on patented Microsoft® SmartScreen Technology. http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines Start

Re: [SQL] getting back autonumber just inserted

2005-02-03 Thread Edmund Bacon
)--- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED]) -- Edmund Bacon <[EMAIL PROTECTED]> ---(end of broadcast)--- TIP 6: Have you searched o

Re: [SQL] Problems with Quotes

2005-01-12 Thread Edmund Bacon
ormation is prohibited and may be unlawful. # ---(end of broadcast)--- TIP 7: don't forget to increase your free space map settings -- Edmund Bacon <[EMAIL PROTECTED]> ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Re: [SQL] Formatting an Interval

2005-01-03 Thread Edmund Bacon
l_sec integer; sec integer; min integer; hr integer; begin select into interval_sec extract (epoch from $1); sec := interval_sec % 60; min := (interval_sec/60)%60; hr := (interval_sec/3600); return hr || '':'' || to_char(min, ''FM00

Re: [SQL] Group by and aggregates

2004-11-04 Thread Edmund Bacon
m(qty) as qty from my_table group by partno, status order by partno, sum(cmup) desc; partno | status | cmup | qty +--+--+- test1 | incoming | 29 | 71 test1 | stock| 10 | 15 test2 | incoming | 12 | 10 -- Edmund Bacon <[EMAIL PROTECTED]>

Re: [SQL] plpgsql: PERFORM vs. SELECT INTO (PERFORM not setting FOUND

2004-10-25 Thread Edmund Bacon
xt(id serial primary key, txt text unique); create table blup(t1 integer references blup_text(id), t2 integer references blub_text(id)); -- Edmund Bacon <[EMAIL PROTECTED]> ---(end of broadcast)--- TIP 8: explain analyze is your friend

Re: [SQL] help with to_date and to_char

2004-10-19 Thread Edmund Bacon
Edmund Bacon wrote: When current_date is, say Aug 31 then select to_char( to_date('05' || '/' || to_char(current_date, 'DD/'), 'MM/DD/' ), 'MON' ); NUTS! that should have been select ... to_date('02' || ... { cu

Re: [SQL] help with to_date and to_char

2004-10-19 Thread Edmund Bacon
: update mytable set myfield=to_date(when_month,'MON'); update mytable set myfield=to_char('05','MON'); as well as update mytable set full_month= to_date('01/'05'/2004','DDMON'); all get errors Please can anyone help? ---

Re: [SQL] Is there a faster way to do this?

2004-06-15 Thread Edmund Bacon
---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED]) -- Edmund Bacon <[EMAIL PROTECTED]> ---(end of broadca

Re: [SQL] a wierd query

2004-05-13 Thread Edmund Bacon
sad wrote: select distinct a as F from table union select distinct b as F from table; Note that UNION only returns the unique values of the union You can get repeated values by using UNION ALL. -- Edmund Bacon <[EMAIL PROTECTED]> ---(end of bro

Re: [SQL] Join issue on a maximum value

2004-04-21 Thread Edmund Bacon
e max() aggregate seems to be the correct path, but for the life of me I can't seem to get the syntax to the point that it produces what I need. Any help would be greatly appreciated! Thanks, -Heflin -- Edmund Bacon <[EMAIL PROTECTED]> ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] Order by YYYY MM DD in reverse chrono order trouble

2004-04-21 Thread Edmund Bacon
can see it. Just changing DESC to ASC, did not work. Thank you! Otis ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED]) -- Edmund Baco

Re: [SQL] Can someone tell me why this statement is failing?

2004-04-20 Thread Edmund Bacon
__ Do you Yahoo!? Yahoo! Photos: High-quality 4x6 digital prints for 25¢ http://photos.yahoo.com/ph/print_splash ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster -- Edmund Bacon <[EMAIL P

Re: [SQL] Functional index and string concatenation

2004-03-08 Thread Edmund Bacon
# create index str_idx on strtable( textcat(str1, str2) ); CREATE INDEX test=# -- Edmund Bacon <[EMAIL PROTECTED]> ---(end of broadcast)--- TIP 7: don't forget to increase your free space map settings

Re: [SQL] Scalar in a range (but textual not numeric)

2004-02-26 Thread Edmund Bacon
On Wed, 2004-02-25 at 12:18, Richard Huxton wrote: As a complete aside: Is there any advantage to use varchar instead of type text? Thanks ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate sub

[SQL] Help refining/eliminating recursive selects

2004-02-19 Thread Edmund Bacon
opping an index) with no luck, yet. Maybe I just haven't hit on the right combination of fields to index on? If anybody can either (a) point me in a better direction, or (b) confirm my approach, I would greatly appreciate it Thanks very much. -- Edmund Bac