Re: [SQL] Understanding Binary Data Type

2012-05-24 Thread Jasen Betts
On 2012-05-22, Carlos Mennens carlos.menn...@gmail.com wrote: Hello everyone! I wanted to ask the list a question about the 'bytea' data type how I can picture this in my head. I've been reading SQL for about a few months now and since then, I've only been working with textual data. Basically

Re: [SQL] sub query and AS

2012-05-24 Thread Samuel Gendler
On Wed, May 23, 2012 at 12:07 PM, Lee Hachadoorian lee.hachadooria...@gmail.com wrote: On Wed, May 23, 2012 at 5:24 AM, Ferruccio Zamuner nonsolos...@diff.org wrote: Hi, I like PostgreSQL for many reasons, one of them is the possibility to use sub query everywhere. Now I've found where

Re: [SQL] left outer join only select newest record

2012-05-24 Thread Pavel Stehule
This was more like what I was thinking, but I still get an error, which I don't understand.  I have extracted the inner sub-select and it does only return one record per registration. (The extra criteria is just to ignore old or cancelled tax requests and doesn't affect the query) goole=#

Re: [SQL] left outer join only select newest record

2012-05-24 Thread Oliveiros d'Azevedo Cristina
Hi, Gary, Unless I'm mistaken this didn't give what you need. Could you please tell me (if you have time) the error returned or wrong result, just for my own understanding of where I've gone sideways on this...? Best, Oliver - Original Message - From: Oliveiros d'Azevedo Cristina

[SQL] Flatten table using timestamp and source

2012-05-24 Thread Elrich Marx
Good day. I am quite new to Postgres, so please bear with me. I have a table with data in the following format: Table name : Time_Source_Table Source , Stime 1, 2012-05-24 13:00:00 1, 2012-05-24 13:01:00 1, 2012-05-24 13:02:00 2, 2012-05-24 13:03:00 2, 2012-05-24 13:04:00 1,

Re: [SQL] Flatten table using timestamp and source

2012-05-24 Thread Raj Mathur (राज माथुर)
On Thursday 24 May 2012, Elrich Marx wrote: I am quite new to Postgres, so please bear with me. I have a table with data in the following format: Table name : Time_Source_Table Source , Stime 1, 2012-05-24 13:00:00 1, 2012-05-24 13:01:00 1, 2012-05-24 13:02:00 2, 2012-05-24 13:03:00

Re: [SQL] Flatten table using timestamp and source

2012-05-24 Thread Elrich Marx
HI Raj If source changes, in this case from 1 to 2, then etime would be the last value of stime for source =1; So for source 1 it starts at stime 13:00 and continues till 13:02 (etime). This should result in 3 records, because source is 1, then 2, then 1 again. I hope this explains ?

Re: [SQL] Understanding Binary Data Type

2012-05-24 Thread F. BROUARD / SQLpro
Hi Le 22/05/2012 19:13, Carlos Mennens a écrit : Hello everyone! I wanted to ask the list a question about the 'bytea' data type how I can picture this in my head. I've been reading SQL for about a few months now and since then, I've only been working with textual data. Basically I'm familiar

[SQL] Inherited table identification possible

2012-05-24 Thread George Woodring
Is it possible to identify which inherited table data came from in a query? We have a table that has 3 inherited tables attached to it. I am looking for a way to identify the source of the data. My only thought would be to add a column to the tables that identify the table. I was just checking

Re: [SQL] Inherited table identification possible

2012-05-24 Thread Jonathan S. Katz
On May 24, 2012, at 2:01 PM, George Woodring wrote: Is it possible to identify which inherited table data came from in a query? We have a table that has 3 inherited tables attached to it. I am looking for a way to identify the source of the data. My only thought would be to add a

Re: [SQL] Inherited table identification possible

2012-05-24 Thread Stephen Belcher
Yes, the system column tableoid identifies the actual table in which the row is stored. If you cast this to regclass you'll get the name of the table that the row is stored in: SELECT tableoid::regclass FROM base_table; There's more documentation on this available at

Re: [SQL] Flatten table using timestamp and source

2012-05-24 Thread Raj Mathur (राज माथुर)
On Thursday 24 May 2012, Elrich Marx wrote: If source changes, in this case from 1 to 2, then etime would be the last value of stime for source =1; So for source 1 it starts at stime 13:00 and continues till 13:02 (etime). This should result in 3 records, because source is 1, then 2, then 1