Re: [GENERAL] Using AND in query

2010-08-08 Thread Alban Hertroys
On 7 Aug 2010, at 23:18, Thomas Kellerer wrote: Or as an alternative: SELECT tid, purchase_date FROM orders WHERE item in ('Laptop', 'Desktop') GROUP BY tid, purchase_date HAVING count(*) = 2 This one is incorrect, it will also find people who bought two laptops or two desktops on the

Re: [GENERAL] Using AND in query

2010-08-08 Thread John R Pierce
The condition and table.item = 'laptop' and table.item = 'Desktop' says: I want all rows where the column item has the value 'Laptop' and *at the same time* has the value 'Desktop' Which clearly cannot be the case (a column can only have a single value) So you need to join all Laptop

Re: [GENERAL] Using AND in query

2010-08-08 Thread Thomas Kellerer
Alban Hertroys wrote on 08.08.2010 10:46: On 7 Aug 2010, at 23:18, Thomas Kellerer wrote: Or as an alternative: SELECT tid, purchase_date FROM orders WHERE item in ('Laptop', 'Desktop') GROUP BY tid, purchase_date HAVING count(*) = 2 This one is incorrect, it will also find people who

Re: [GENERAL] Howto only select secific lines from a result?

2010-08-08 Thread Alban Hertroys
On 8 Aug 2010, at 3:37, Clemens Eisserer wrote: What I would need is a LIMIT command, which allows to LIMIT the results in two ways. Is there some way to select only specific lines from a result, something like: Select * from table Where RESULNR BETWEEN 1000 and 1040? Or do you have any

Re: [GENERAL] MySQL versus Postgres

2010-08-08 Thread Torsten Zühlsdorff
Scott Frankel schrieb: On Aug 6, 2010, at 6:13 AM, Torsten Zühlsdorff wrote: John Gage schrieb: On reflection, I think what is needed is a handbook that features cut and paste code to do the things with Postgres that people do today with MySQL. Everyone of my trainees want such thing -

Re: [GENERAL] Accessing a database via AJAX scripts

2010-08-08 Thread Tom Lane
Glen Eustace geust...@godzone.net.nz writes: My goal is to have a perl cgi script (that is accessed using AJAX) perform some operations in a database using DBI. Some of the actions are likely to take a while so my intent was to have a table that the backend process periodically writes

Re: [GENERAL] could you tell me this..?

2010-08-08 Thread Lew
Please do not top-post. On 08/05/2010 09:42 AM, Ketema Harris wrote: Never kill -9. Use kill -INT, whatever signal num that is, 11? man kill INT2 SEGV 11 -- Lew -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription:

Re: [GENERAL] Accessing a database via AJAX scripts

2010-08-08 Thread Glen Eustace
Hi Tom, On 08/09/2010 03:33 AM, Tom Lane wrote: Your note is awfully short of concrete details, but I'm guessing the basic reason why this wasn't working for you was you were doing all the operations as a single transaction. The results of that transaction wouldn't be visible to another one

Re: [GENERAL] Accessing a database via AJAX scripts

2010-08-08 Thread Tom Lane
Glen Eustace geust...@godzone.net.nz writes: Unfortunately your comments don't shed any light on the error I am getting; could not receive data from server: Bad file descriptor. This suggests to me that I might have lost the connection in my forked perl process to the back-end. Can you

Re: [GENERAL] Using AND in query

2010-08-08 Thread David Fetter
On Sun, Aug 08, 2010 at 01:55:19AM -0700, John R Pierce wrote: The condition and table.item = 'laptop' and table.item = 'Desktop' says: I want all rows where the column item has the value 'Laptop' and *at the same time* has the value 'Desktop' Which clearly cannot be the case (a column

[GENERAL] Help with select with max and min please

2010-08-08 Thread Jose Maria Terry
Hello all, I need to run a query on a table that holds logged data from several water flow meters. I need the first and last values (with their associated time) for every logger in a time range. I've tried this that returns the min and max time in the desired range for every logger, but

Re: [GENERAL] Help with select with max and min please

2010-08-08 Thread Edoardo Panfili
On 08/08/10 20.47, Jose Maria Terry wrote: Hello all, I need to run a query on a table that holds logged data from several water flow meters. I need the first and last values (with their associated time) for every logger in a time range. I've tried this that returns the min and max time in

Re: [GENERAL] Help with select with max and min please

2010-08-08 Thread Jose Maria Terry
El 08/08/10 21:49, Edoardo Panfili escribió: On 08/08/10 20.47, Jose Maria Terry wrote: Hello all, I need to run a query on a table that holds logged data from several water flow meters. I need the first and last values (with their associated time) for every logger in a time range. I've

Re: [GENERAL] Accessing a database via AJAX scripts

2010-08-08 Thread Glen Eustace
Not on that much evidence; but trying to pass a libpq connection across a fork is usually risky. The trouble is that both parent and child processes now hold copies of the open socket connection, but only one of them can safely work with it. It could be that you've closed the libpq connection

Re: [GENERAL] Using AND in query

2010-08-08 Thread David Fetter
On Sun, Aug 08, 2010 at 12:33:40PM -0700, David Fetter wrote: On Sun, Aug 08, 2010 at 01:55:19AM -0700, John R Pierce wrote: The condition and table.item = 'laptop' and table.item = 'Desktop' says: I want all rows where the column item has the value 'Laptop' and *at the same

Re: [GENERAL] MySQL versus Postgres

2010-08-08 Thread Scott Frankel
On Aug 8, 2010, at 2:45 AM, Torsten Zühlsdorff wrote: Scott Frankel schrieb: On Aug 6, 2010, at 6:13 AM, Torsten Zühlsdorff wrote: John Gage schrieb: On reflection, I think what is needed is a handbook that features cut and paste code to do the things with Postgres that people do today