[GENERAL] Query question

2009-02-24 Thread Sharma, Sid
Hi, I am new to Postgres and am trying to write a query like the one below (without any luck) SELECT col_speed, col_time, (col_speed / col_time) AS distance FROM speed_ratings HAVING distance ? ORDER BY distance In other words, I want to filter on a calculated column. But I get an

Re: [GENERAL] Query question

2009-02-24 Thread Adam Rich
-Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general- ow...@postgresql.org] On Behalf Of Sharma, Sid Sent: Tuesday, February 24, 2009 12:47 PM To: pgsql-general@postgresql.org Subject: [GENERAL] Query question Hi, I am new to Postgres and am

Re: [GENERAL] Query Question

2009-02-11 Thread Clemens Schwaighofer
clemens.schwaigho...@tequila.jp wrote: From: Schwaighofer Clemens clemens.schwaigho...@tequila.jp Subject: [GENERAL] Query Question To: pgsql-general@postgresql.org Received: Tuesday, February 10, 2009, 5:30 AM I have two tables Table public.mailings Column | Type| Modifiers

[GENERAL] Query Question

2009-02-10 Thread Schwaighofer Clemens
I have two tables Table public.mailings Column | Type| Modifiers +---+--- key| character varying | name | character varying | Table public.userdata Column | Type| Modifiers

Re: [GENERAL] Query question

2009-01-15 Thread Sam Mason
On Wed, Jan 14, 2009 at 07:36:03PM -0800, mailingli...@net-virtual.com wrote: CREATE TABLE listings ( trans_id SERIAL, mode CHAR(1), listing_id INT, region_id INT, category INT ); SELECT * FROM listings ORDER BY region_id, category, listing_id, trans_id [...] what I want to

Re: [GENERAL] Query question

2009-01-15 Thread mailinglists
On Wed, Jan 14, 2009 at 07:36:03PM -0800, mailingli...@net-virtual.com wrote: CREATE TABLE listings ( trans_id SERIAL, mode CHAR(1), listing_id INT, region_id INT, category INT ); SELECT * FROM listings ORDER BY region_id, category, listing_id, trans_id [...] what I want

[GENERAL] Query question

2009-01-14 Thread mailinglists
Hello, Thanks to the replier (Martijn -- thank you very much!) to an earlier question I had about MVCC, I've decided to re-think entirely my use of the status column in a table. What I've decided to do is to put all of my new or changed records into a holding table, then after they are indexed,

Re: [GENERAL] Query Question (one group by vs two separate)

2008-12-15 Thread Jonathon Suggs
Thanks Joris. I'm familiar with explain and I do use it quite frequently. My site is just starting out so I don't think performance is that crucial of an issue at the onset (premature optimization). Also, there is not that much data yet so its difficult to have a very accurate picture of what a

Re: [GENERAL] Query Question (one group by vs two separate)

2008-12-13 Thread Joris Dobbelsteen
Jonathon Suggs wrote, On 10-12-08 20:12: I'm asking this as a more general question on which will perform better. I'm trying to get a set of comments and their score/rankings from two tables. *comments* cid (integer, primary key) title body *comment_ratings* cid (integer, primary key) uid

[GENERAL] Query Question (one group by vs two separate)

2008-12-11 Thread Jonathon Suggs
I'm asking this as a more general question on which will perform better. I'm trying to get a set of comments and their score/rankings from two tables. *comments* cid (integer, primary key) title body *comment_ratings* cid (integer, primary key) uid (integer, primary key) score *Option 1*

Re: [GENERAL] query question really cant give a summary here so read the body ;-)

2008-04-25 Thread Rhys Stewart
Indeed, I will endeavour to limit the length of my replies, although my extemporaneous nature, while ranting, will invariably result in prolonged discourse on my part . I am also grateful for your willingness to assist and saddened that you are ill. I do hope you recovery quickly. The example I

Re: [GENERAL] query question really cant give a summary here so read the body ;-)

2008-04-25 Thread Colin Wetherbee
Rhys Stewart wrote: The example I provided earlier was a very simplified model of the table I'm working with after a self join. The table in question contains geographic data (linestrings) PostGIS LINESTRINGs? and I have written a function to return a textual representation Like

Re: [GENERAL] query question really cant give a summary here so read the body ;-)

2008-04-25 Thread Rhys Stewart
Yes, PostGIS LINESTRINGS, no not ST_AsEWKT(). By similar configuration I mean shape. So I can identify two lines if they have a similar shape. No not ST_Distance()and don't call me Shirley. I also neglected to include the query in my previous post. SELECT a.id,b.id FROM subsumed_secondary a

Re: [GENERAL] query question really cant give a summary here so read the body ;-)

2008-04-24 Thread Rhys Stewart
While I thank you for your time in reading and responding, minor rant follows This world is not ideal at any level, be it the lack of financial equity, the petty prejudices that permeate societies on a whole, increasing gas and food prices worldwide (I've officially parked my car and am taking the

Re: [GENERAL] query question really cant give a summary here so read the body ;-)

2008-04-24 Thread Scott Marlowe
On Thu, Apr 24, 2008 at 3:43 PM, Rhys Stewart [EMAIL PROTECTED] wrote: type). That being said, I would appreciate that any further questions I have not be responded to by single line emails extolling the virtues of properly designed schemata, normalization or the like./minor rant precedes

Re: [GENERAL] query question really cant give a summary here so read the body ;-)

2008-04-24 Thread Erik Jones
On Apr 24, 2008, at 5:43 PM, Scott Marlowe wrote: On Thu, Apr 24, 2008 at 3:43 PM, Rhys Stewart [EMAIL PROTECTED] wrote: type). That being said, I would appreciate that any further questions I have not be responded to by single line emails extolling the virtues of properly designed

Re: [GENERAL] query question really cant give a summary here so read the body ;-)

2008-04-24 Thread Joshua D. Drake
Erik Jones wrote: Next time I'll hold your hand a bit more, but yesterday I was very far out of it (I'm not exactly 100% today either) with a bad head cold. Now, should we have more exchanges to determine who can use the most flowery of speech or should we talk pgsql and schema changes?

[GENERAL] query question really cant give a summary here so read the body ;-)

2008-04-23 Thread Rhys Stewart
Hi all, have the following table aid| bid -- 1|5 2|6 3|7 4|9 5|1 6|2 7|3 8|10 9|4 10 |8 both aid bid represent the same data in another table, but the table has duplicate data and i did a self-join to get the id's out. The question is how do

Re: [GENERAL] query question really cant give a summary here so read the body ;-)

2008-04-23 Thread Scott Marlowe
I'd say you need to rethink your schema. On Wed, Apr 23, 2008 at 12:11 PM, Rhys Stewart [EMAIL PROTECTED] wrote: Hi all, have the following table aid| bid -- 1|5 2|6 3|7 4|9 5|1 6|2 7|3 8|10 9|4 10 |8 both aid bid represent

Re: [GENERAL] query question really cant give a summary here so read the body ;-)

2008-04-23 Thread James Strater
This works in oracle: SELECT aid, bid FROM aidbid WHERE aid bid UNION SELECT bid, aid FROM aidbid WHERE bid aid Rhys Stewart [EMAIL PROTECTED] wrote: Hi all, have the following table aid| bid -- 1|5 2|6 3|7 4|9 5|1 6|2 7|3 8

Re: [GENERAL] query question really cant give a summary here so read the body ;-)

2008-04-23 Thread Roberts, Jon
; $$ language 'plpgsql'; select * from fn_ugly(); Jon From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rhys Stewart Sent: Wednesday, April 23, 2008 1:12 PM To: pgsql-general@postgresql.org Subject: [GENERAL] query question really cant give a summary

Re: [GENERAL] query question really cant give a summary here so read the body ;-)

2008-04-23 Thread Raymond O'Donnell
On 23/04/2008 20:33, Roberts, Jon wrote: create table ugly [...snip...] create or replace function fn_ugly() returns setof ugly as [...snip...] create temporary table temp_ugly [...snip...] select * from fn_ugly(); [...snip...] Heh heh - I think we get the point! LOL :-) Ray.

Re: [GENERAL] query question really cant give a summary here so read the body ;-)

2008-04-23 Thread Roberts, Jon
On 23/04/2008 20:33, Roberts, Jon wrote: create table ugly [...snip...] create or replace function fn_ugly() returns setof ugly as [...snip...] create temporary table temp_ugly [...snip...] select * from fn_ugly(); [...snip...] Heh heh - I think we get the point!

Re: [GENERAL] query question really cant give a summary here so read the body ;-)

2008-04-23 Thread Colin Wetherbee
Roberts, Jon wrote: On 23/04/2008 20:33, Roberts, Jon wrote: create table ugly [...snip...] create or replace function fn_ugly() returns setof ugly as [...snip...] create temporary table temp_ugly [...snip...] select * from fn_ugly(); [...snip...] Heh heh - I think we get the point!

Re: [GENERAL] Query Question

2005-09-29 Thread Jim C. Nasby
SELECT c.name, w.ib, c.vbp, c.year_balance FROM clients c LEFT JOIN workers w ON (w.client_id = c.id) ; Will do the trick. BTW, I suggest not using 'bareword' id's for field names. It's very easy to get confused with larger queries. So instead of clients.id, do clients.client_id. I

[GENERAL] Query Question

2005-09-27 Thread Frodo Larik
Hi All, I have the following simplified setup. A client has 2 products: 'vbp' and 'year_balance', but a client has also workers who have a product, named 'ib'. A client can have multiple workers. -- clients CREATE TABLE clients ( id serial NOT NULL PRIMARY KEY, name text NOT NULL,

[GENERAL] query-question

2003-09-11 Thread Alexander Blüm
hello, I'm facing an odd problem. I have a query: SELECT Kürzel, Autor(en), Titel FROM tblTitelangaben WHERE Titel||Kürzel||Monographie-Kürzel||Autor(en) ILIKE '%er%'; this works like a charm. but if I add another ||something - which might be emtpy, I get no results.. why? WHERE

Re: [GENERAL] query-question

2003-09-11 Thread Pavel Stehule
Hello || isn't OR!! testdb011= select ''||'bbb'; ?column? - bbb This is SQL, not java or C. OR is OR in SQL :- Pavel On Thu, 11 Sep 2003, [ISO-8859-1] Alexander Blm wrote: hello, I'm facing an odd problem. I have a query: SELECT Krzel, Autor(en), Titel

[GENERAL] Query Question

2001-04-23 Thread Hunter Hillegas
I have 4 tables: releases, artist_info, categories, and formats. I am using this query: SELECT DISTINCT *, categories.category_name as category_name, categories.rec_num as category, formats.format_name as format_text, releases.rec_num as release_rec_num, artist_info.name as artist_name FROM

Re: [GENERAL] Query Question

2001-04-23 Thread Stephan Szabo
On Mon, 23 Apr 2001, Hunter Hillegas wrote: I have 4 tables: releases, artist_info, categories, and formats. I am using this query: SELECT DISTINCT *, categories.category_name as category_name, categories.rec_num as category, formats.format_name as format_text, releases.rec_num as

Re: [GENERAL] Query Question

2001-04-23 Thread Hunter Hillegas
That fixed it! Thanks! Hunter From: Stephan Szabo [EMAIL PROTECTED] Date: Mon, 23 Apr 2001 14:54:50 -0700 (PDT) To: Hunter Hillegas [EMAIL PROTECTED] Cc: PostgreSQL [EMAIL PROTECTED] Subject: Re: [GENERAL] Query Question On Mon, 23 Apr 2001, Hunter Hillegas wrote: I have 4 tables

[GENERAL] Query question

2001-01-18 Thread Jorch
How can I make query SELECT * FROM my_table WHERE my_field = 'A*'; Meaning that I want to get all rows from my_table where my_field value begins with alphabet "A"

RE: [GENERAL] Query question

2001-01-18 Thread Colin Taylor
SELECT * FROM my_table WHERE my_field LIKE 'A%'; Should do it! -Original Message- From: Jorch [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 16, 2001 5:40 PM To: [EMAIL PROTECTED] Subject: [GENERAL] Query question How can I make query SELECT * FROM my_table WHERE my_field

[GENERAL] query question

2000-09-07 Thread chris mutchler
I am new to using postgresql and have the following question. if i submit a query (through a perl script), what values (and in what order) will be returned to me? here is my query: SELECT p.ids_name, m.start_time, m.end_time FROM mail_schedule m, personnel p WHERE