Re: [SQL] How to re-sort a sorted query?

2004-10-26 Thread Tom Lane
Oliver Elphick <[EMAIL PROTECTED]> writes: > On Tue, 2004-10-26 at 14:23 -0500, Yudie wrote: >> Then I do this query to get unique store number and also the cheapest >> price from each store: >> >> SQL= "Select distinct on (storenumber), itemsku, storenumber,price >> from storeproduct where itemsk

Re: [SQL] How to re-sort a sorted query?

2004-10-26 Thread Oliver Elphick
On Tue, 2004-10-26 at 17:43 -0400, Tom Lane wrote: > Oliver Elphick <[EMAIL PROTECTED]> writes: > > On Tue, 2004-10-26 at 14:23 -0500, Yudie wrote: > >> Then I do this query to get unique store number and also the cheapest > >> price from each store: > >> > >> SQL= "Select distinct on (storenumber

Re: [SQL] How to re-sort a sorted query?

2004-10-26 Thread Yudie
Oliver ,sorry, I didn't submit all complete fields as my example, The reason I didn't use agregate function because I still need to select another fields from storeproduct table and some outer joins. What about if the data in storeproduct table shows like this: ItemSku , StoreNumber , Price, Con

Re: [SQL] How do you compare (NULL) and (non-NULL)?

2004-10-26 Thread Stephan Szabo
On Tue, 26 Oct 2004, Wei Weng wrote: > In the following query > > SELECT Parent FROM Channels ORDER BY Parent ASC; > > If I have a couple of (NULL)s in the field [Parent], they will be listed at > the bottom of the query result. > > Is it because PostgreSQL considers (NULL) as the biggest value? I

Re: [SQL] How do you compare (NULL) and (non-NULL)?

2004-10-26 Thread Jerome Alet
On Tue, Oct 26, 2004 at 01:48:48PM -0700, Stephan Szabo wrote: > On Tue, 26 Oct 2004, Wei Weng wrote: > > > In the following query > > > > SELECT Parent FROM Channels ORDER BY Parent ASC; > > > > If I have a couple of (NULL)s in the field [Parent], they will be listed at > > the bottom of the quer

Re: [SQL] How to re-sort a sorted query?

2004-10-26 Thread Oliver Elphick
On Tue, 2004-10-26 at 14:23 -0500, Yudie wrote: > I have a query that need to be sorted in order of price of store's > product with unique store number. > > Here is a sample data of storeproduct table: > > > ItemSku , StoreNumber , Price > == > 10001 , 7 , 30.00 > 1000

[SQL] How do you compare (NULL) and (non-NULL)?

2004-10-26 Thread Wei Weng
In the following query SELECT Parent FROM Channels ORDER BY Parent ASC; If I have a couple of (NULL)s in the field [Parent], they will be listed at the bottom of the query result. Is it because PostgreSQL considers (NULL) as the biggest value? If I run the same query under MSSQL Server 2000, I g

[SQL] How to re-sort a sorted query?

2004-10-26 Thread Yudie
I have a query that need to be sorted in order of price of store's product with unique store number.   Here is a sample data of storeproduct table:     ItemSku , StoreNumber , Price == 10001 , 7 , 30.00 10001 , 7 , 35.00 <-- duplicate store number 10001 , 5 , 45

[SQL] How to recognize trigger-inserted rows?

2004-10-26 Thread Jeff Boes
I have a table with an INSERT/UPDATE/DELETE statement trigger. The trigger's action is to insert "jobs" into a queue noting that the table has changed. A number of other tables have FK relationships with this table, and they have their own statement triggers that fire on DELETE. When I delete a n