Re: [SQL] Most efficient way to hard-sort records

2006-05-06 Thread Ben K.
main_table: id, name, position key_table: id, main_table_id, key, value Here is how I need to sort the records: SELECT * FROM main_table INNER JOIN key_table ON main_table.id = key_table.main_table_id WHERE key = 'param' ORDER BY value I currently collect all ids from main_table in sorted order

Re: [SQL] Returning String as Integer

2006-05-06 Thread Ben K.
My twopence. I just happened to have the same problem with iReports for a 10 digit number - it may be case specific but in my case Please, take care with your quote attributions. I've never asked such a question here and, in fact, I was answering it. The person who asked such a question was Ka

Re: [SQL] Returning String as Integer

2006-05-06 Thread Jorge Godoy
Em Sábado 06 Maio 2006 17:05, Ben K. escreveu: > Jorge Godoy <[EMAIL PROTECTED]> wrote: > > numbers. Is there any way to select a value from this column and return > > it as an integer? > > My twopence. I just happened to have the same problem with iReports for a > 10 digit number - it may be case

Re: [SQL] Returning String as Integer

2006-05-06 Thread Ben K.
Jorge Godoy <[EMAIL PROTECTED]> wrote: numbers. Is there any way to select a value from this column and return it as an integer? My twopence. I just happened to have the same problem with iReports for a 10 digit number - it may be case specific but in my case # select ... int4(id) ..

Re: [SQL] grant select on database demo to user

2006-05-06 Thread Bryce Nesbitt
A. Kretschmer wrote: > Is there a way to grant to all tables, with a single grant? I know how > > > No, but you can use a little Script, please read: > http://people.planetpostgresql.org/greg/index.php?/archives/38-guid.html#extended > > HTH, Andreas > Thanks, What always happens is I create

Re: [SQL] problem with uniques and foreing keys

2006-05-06 Thread Stephan Szabo
On Sat, 6 May 2006, kernel.alert kernel.alert wrote: > I create the follow tables... > > > > CREATE TABLE empresa ( > id_empresa integer NOT NULL primary key, > nombre varchar(45), > ); > CREATE TABLE casino ( > i

Re: [SQL] problem with uniques and foreing keys

2006-05-06 Thread kernel.alert kernel.alert
Sorry i had a mistake in the post it was with the definition of the primary key in the empresa table...I'm having the same error when i build the last table...thanks for your answers...  Hi list...Please i have a problem with this... I create the follow tables...

Re: [SQL] problem with uniques and foreing keys

2006-05-06 Thread Bruno Wolff III
On Sat, May 06, 2006 at 12:27:41 -0500, "kernel.alert kernel.alert" <[EMAIL PROTECTED]> wrote: > Hi list... > > Please i have a problem with this... > > I create the follow tables... > > > > CREATE TABLE empresa ( > id_empresa

Re: [SQL] problem with uniques and foreing keys

2006-05-06 Thread Terry Lee Tucker
On Saturday 06 May 2006 01:27 pm, "kernel.alert kernel.alert" <[EMAIL PROTECTED]> thus communicated: --> Hi list... --> --> Please i have a problem with this... --> --> I create the follow tables... --> --> --> --> CREATE TABLE empresa ( -->

[SQL] problem with uniques and foreing keys

2006-05-06 Thread kernel.alert kernel.alert
Hi list...Please i have a problem with this...I create the follow tables...CREATE TABLE empresa (  id_empresa integer  NOT NULL primary key,   nombre varchar(45),);CREATE TABLE casino (  id_casino  integer  NOT NULL

Re: [SQL] Returning String as Integer

2006-05-06 Thread Bruno Wolff III
On Fri, May 05, 2006 at 18:52:19 -0300, Jorge Godoy <[EMAIL PROTECTED]> wrote: > Em Sexta 05 Maio 2006 18:37, Kashmira Patel (kupatel) escreveu: > > Hi all, > >I have a table with a column of type 'text'. It mainly contains > > numbers. Is there any way to select a value from this column and

Re: [SQL] Most efficient way to hard-sort records

2006-05-06 Thread Markus Schaber
Hi, Miroslav, Miroslav Šulc schrieb: > I have a table with cca 100,000 records. I need to hard-sort the records > by a key from second table. By hard-sorting I mean storing position of > each row in the main table. Here is what my tables look like: > > main_table: id, name, position > key_table:

[SQL] Most efficient way to hard-sort records

2006-05-06 Thread Miroslav Šulc
Hello, I have a table with cca 100,000 records. I need to hard-sort the records by a key from second table. By hard-sorting I mean storing position of each row in the main table. Here is what my tables look like: main_table: id, name, position key_table: id, main_table_id, key, value Here is how