[SQL] Creating timestamps in queries?

2000-07-10 Thread Rob S.
Hi all, I would like to say, "select * from blah where stamp >= 7 days ago" ...where the "days ago" is calculated at query time; meaning that its not hardcoded into the query as a date string. Is this possible? TIA! =) - Rob Slifka

Re: [SQL] Finding entries not in table..differnce?

2000-07-10 Thread Erol Oz
If I understand you exactly, you may use except: select distinct * from prodlang except select distinct * from prodlang2 gives you the records which exist in prodlang and do not exist in prodlang2. So you get all the records in prodlang which are newly inserted or updated. regards erol Zot O'C

Re: [SQL] Finding entries not in table..differnce?

2000-07-10 Thread Stephan Szabo
Assuming that you don't have nulls in prodlang.prodlsku, this should probably work, although I haven't tried it for real. SELECT prodlang.prodlsku FROM prodlang WHERE NOT EXISTS (SELECT * FROM prodlang2 WHERE prodlang2.prodlsku=prodlang.prodlsku); If you do have nulls, the inner select proba

[SQL] Finding entries not in table..differnce?

2000-07-10 Thread Zot O'Connor
I need to write a quick function that tells me all of the entriles in table that are not in table2. The tables are copies of each other, but 1 has been updated. I know this is easy, but I am running on little sleep :) I want to due something like select prodlang.prodlsku from prodland,prodlang

[SQL] Error : Unknown address family (0)

2000-07-10 Thread Ed
Each time I try to do an pg_dump or pg_dumpall I receive this message : Error : Unknown address family (0) What can I do to resolve this? Or at least what does it means? Thanks a lot! Frédéric Boucher [EMAIL PROTECTED]

Re: [SQL] Re: Matching and Scoring with multiple fields

2000-07-10 Thread Ed Loehr
Tim Johnson wrote: > > I have a table like this: > > a,b,c,d,e,f,g,h > --- > 2,5,3,4,4,5,2,2 > 1,1,1,1,1,1,1,1 > > a to h are of type int. > > I want to take input values which relate to this table say: > how do you feel about a: > how do you feel about b: > how do you feel about c

Re: [SQL] Re: Matching and Scoring with multiple fields

2000-07-10 Thread Oliver Mueschke
I'm not sure, but it seems you could calculate a column like: SELECT a,b,c,..., abs(-a)+abs(-b)+abs(-c)+... AS weight FROM t ORDER BY weight This way the closest matches would come first. On Mon, Jul 10, 2000 at 07:56:08PM +0100, Tim Johnson wrote: > I have a problem. Ok I'll

[SQL] Re: Matching and Scoring with multiple fields

2000-07-10 Thread Tim Johnson
I have a problem. Ok I'll rephrase that, a challenge. I have a table like this: a,b,c,d,e,f,g,h --- 2,5,3,4,4,5,2,2 1,1,1,1,1,1,1,1 5,5,5,5,5,5,5,5 3,3,2,4,5,1,1,3 1,1,5,5,5,5,1,4 1,5,5,5,4,4,2,1 5,5,5,5,1,1,1,1 1,1,1,1,5,5,5,5 (rows 8) a to h are of type int. I want to take input

Re: [SQL] Timestamp problem

2000-07-10 Thread Ed Loehr
Bernie Huang wrote: > > table > - > ... > borrow timestamp > return timestamp > > Now, I thought timestamp is in sec eg; 35434434, but in PostgreSQL, it > shows up as datetime datatype eg; 2000-06-07 17:00:05-07. > > I was wondering is this format a correct one for timestamp, or is it a

[SQL] Timestamp problem

2000-07-10 Thread Bernie Huang
Hi, I have Postgres 7.0, and I created a table table - ... borrow timestamp return timestamp Now, I thought timestamp is in sec eg; 35434434, but in PostgreSQL, it shows up as datetime datatype eg; 2000-06-07 17:00:05-07. I was wondering is this format a correct one for timestamp, or i

Re: [SQL] problem with date

2000-07-10 Thread DalTech - Continuing Technical Education
Try NULL rather than ''. '' is not a null in postgres. - Original Message - From: Shalini shikha <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, July 10, 2000 3:15 PM Subject: [SQL] problem with date > How can I insert/update a null value in a date field. If a try a sql > s

Re: [SQL] SERIAL type does not generate new ID ?

2000-07-10 Thread Ed Loehr
Jean-Marc Libs wrote: > > I have this table: > > CREATE TABLE film ( >film_id serial, > ... > > SELECT setval ('film_film_id_seq', 6); > > I have this query in PHP: > insert into film > >(film_country_id,film_country_id2,film_country_id3,film_country_id4,film_prod_year,film_ec_certif,film_

[SQL] problem with date

2000-07-10 Thread Shalini shikha
How can I insert/update a null value in a date field. If a try a sql statement like the following: update customer set birth_date = '' where cust_id like 'xyz', I get a error message saying: Bad date representation. Thanks in advance, Shalini

[SQL] SERIAL type does not generate new ID ?

2000-07-10 Thread Jean-Marc Libs
Hi all, I don't really understand what happens, so I put context, then problem: 1/ Context -- I have this table: CREATE TABLE film ( film_id SERIAL PRIMARY KEY, film_country_id CHAR(2), film_country_id2 CHAR(2), film_country_id3 CHAR(2), film_country_id4 CHAR(2), film_ec_certif BOOL DEF

RE: [SQL] How to get a self-conflicting row level lock?

2000-07-10 Thread Mikheev, Vadim
> Is it true that SELECT ... FOR UPDATE only acquires a ROW > SHARE MODE lock, and that it isn't self-conflicting? SELECT FOR UPDATE acquires ROW SHARE LOCK on *table* level. But rows returned by SELECT FOR UPDATE is locked *exclusively* - so any other transaction which tries to mark the same

[SQL] Supported Encoding

2000-07-10 Thread Tony Nakamura
Hello people, I need answers to a simple question that I couldn't find the definite answer for: Does Postgresql support only EUC? Basically, I am trying to save international fonts to Postgresql, so I'm trying to find out what exactly I need to do. It seems like it works fine when I am using PHP

[SQL] Subselects with IN and EXISTS

2000-07-10 Thread Dorin Grunberg
Hello, Here is my query. SELECT id, title, type, sub_type, order_number, version, date, referred_to, referred_in FROM sop WHERE (type||sub_type||order_number, version) IN ^^^ (SELECT type||sub_type||order_number, max(version) FROM sop GROUP BY type||sub_type||order_number) ORDER BY type, sub_t

Re: [SQL] Type conversion

2000-07-10 Thread Thomas Lockhart
> select TheNumberFromConsole/(select max(division_point) from table1) Try select '1234.5678'/(select max(division_point) from table1); The quotes around the apparent floating point number keeps Postgres from assuming that it *is* a floating point number, and it later decides that it must hav

Re: [SQL] Corruption... please help

2000-07-10 Thread Bruce Momjian
[ Charset ISO-8859-1 unsupported, converting... ] > Hi... > > I am unable to select every row from a table. Every time, the backend > disconnect. When I do a : > > The_DB=> vacuum; > > I get : > > ERROR: Invalid XID in t_cmin (2) > > What does it meens and how can I recover from it? > Ar

[SQL] Corruption... please help

2000-07-10 Thread Ed
Hi... I am unable to select every row from a table. Every time, the backend disconnect. When I do a : The_DB=> vacuum; I get : ERROR: Invalid XID in t_cmin (2) What does it meens and how can I recover from it? Frédéric Boucher [EMAIL PROTECTED]

[SQL] Type conversion

2000-07-10 Thread Ice Planet
Hello I have one big select that computes some value. The value is in format numeric (40,4). Then is this value send to console and when someone on console agree with the number then is the number send to database where i need to do something like this select TheNumberFromConsole/(select max(

Re: [SQL] CREATE TABLE with foreign key and primary key

2000-07-10 Thread Oliver Elphick
"Paulo Roberto Siqueira" wrote: >ufgvirtual=# create table matricula ( >ufgvirtual(# id_aluno char(15) references pessoa, >ufgvirtual(# id_curso int4 references curso_polo, >ufgvirtual(# id_polo int2 references curso_polo, >ufgvirtual(# local_prova varchar(50) not null, >ufgvirtual(# a