Re: [SQL] Ordering by field using lower()

2001-10-13 Thread Tom Lane
speedboy <[EMAIL PROTECTED]> writes: > Hi, please view the output from some queries below. My question is, why is > the ordering apparently wrong when using the lower() function? You're getting a textual sort, not a numeric sort. > The field "pid" is of type int2 and there is no need to use lowe

[SQL] Ordering by field using lower()

2001-10-13 Thread speedboy
Hi, please view the output from some queries below. My question is, why is the ordering apparently wrong when using the lower() function? The field "pid" is of type int2 and there is no need to use lower(), but I will need to put a test clause in php if my order type is pid so I do not use lower(

Re: [SQL] MEDIAN as custom aggregate?

2001-10-13 Thread Masaru Sugawara
On Fri, 12 Oct 2001 12:38:12 -0700 "Josh Berkus" wrote: > For those whose stats terminology is rusty, the "median" is the "middle" > value in a distribution. For example, if we had the following data: > > Table ages > personage > Jim 21 > Rusty 24 > Carol

Re: [SQL] GROUPING

2001-10-13 Thread Stephan Szabo
On Sat, 13 Oct 2001, Timothy J Hitchens wrote: > It's been a while since I used postgresql but today I have converted one > of my web apps but with one small problem. I goto do a group as > designed and executed in mysql and I get told that this and this must be > part of the aggreate etc I am p

Re: [SQL] MEDIAN as custom aggregate?

2001-10-13 Thread Tom Lane
"Josh Berkus" <[EMAIL PROTECTED]> writes: > The query I'll use is this: > SELECT site, COUNT(pageviews) as count_views, AVG(pageviews) AS > mean_views, median_views > FROM sites, > (SELECT pageviews as median_view >FROM pageviews >LIMIT 1 OFFSET middlerec('pageviews')) med

Re: [SQL] VARCHAR vs TEXT

2001-10-13 Thread Bruce Momjian
> On Wed, 10 Oct 2001, Aasmund Midttun Godal wrote: > > > I am sure this question has been answered in some form or another > > before, but I can't really find anything on exactly this issue. > > > > Are there any differences between varchar and text other than > > > > 1. varchar has limited si