Thread: date

date

From
Roland_DUBOULOZ
Date:
I have a table like this :  table  books (name varchar , return_date date)

The field return_date is not initialized :
insert into books values (name1);
insert into books values (namex);

The field return_date is updated when the books is returned like this :

update books set return_date='10-06-1999' where name=xxx;

How can i select all the item where the return_date is not updated ?

a request like this :

select * from books where return_date=''  ????


(actually i initialised the return_date with the values '01-01-0001')



thank you.


-- 
Roland Dubouloz            BULL XS/BU
BULL SA                mailto:Roland.Dubouloz@bull.net
1,Rue de Provence        Phone :+33 (0)4 76 29 77 87
BP 208                Bullcom : 229-7787
38432 Echirolles CEDEX        Office  : A1-052
France                Fax     : +33 (0)4 76 29 70 02


Re: [SQL] date

From
José Soares
Date:

Roland_DUBOULOZ ha scritto:

> I have a table like this :
>    table  books (name varchar , return_date date)
>
> The field return_date is not initialized :
> insert into books values (name1);
> insert into books values (namex);
>
> The field return_date is updated when the books is returned like this :
>
> update books set return_date='10-06-1999' where name=xxx;
>
> How can i select all the item where the return_date is not updated ?
>
> a request like this :
>
> select * from books where return_date=''  ????
>

SELECT * FROM books WHERE return_date IS NULL;

>
> (actually i initialised the return_date with the values '01-01-0001')
>
> thank you.
>
> --
> Roland Dubouloz                 BULL XS/BU
> BULL SA                         mailto:Roland.Dubouloz@bull.net
> 1,Rue de Provence               Phone :+33 (0)4 76 29 77 87
> BP 208                          Bullcom : 229-7787
> 38432 Echirolles CEDEX          Office  : A1-052
> France                          Fax     : +33 (0)4 76 29 70 02

______________________________________________________________
PostgreSQL 6.5.0 on i586-pc-linux-gnu, compiled by gcc 2.7.2.3
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jose'




Re: date

From
"wishy wishy"
Date:
hi folks,
we have a PostgreSQL 7.2.2 on i686-pc-linux-gnu, compiled by GCC 2.96
installation on pogo linux 7.2
we are facing a data problem when we do the following
select to_char(to_date('1969-10-22','YYYY-MM-DD'),'YYYY-MM-DD');

ERROR:  Unable to convert date to tm

we have been trying to find a solution for this have you found such
instances before it there a method to over come this.
Any help will be greatly appreciated.
thanks
kris




_________________________________________________________________
Get faster connections�-- switch to�MSN Internet Access! 
http://resourcecenter.msn.com/access/plans/default.asp



Re: date

From
Jean-Luc Lachance
Date:
Try 

select to_char( '1969-10-22'::date, 'YYYY-MM-DD');


wishy wishy wrote:
> 
> hi folks,
> we have a PostgreSQL 7.2.2 on i686-pc-linux-gnu, compiled by GCC 2.96
> installation on pogo linux 7.2
> we are facing a data problem when we do the following
> select to_char(to_date('1969-10-22','YYYY-MM-DD'),'YYYY-MM-DD');
> 
> ERROR:  Unable to convert date to tm
> 
> we have been trying to find a solution for this have you found such
> instances before it there a method to over come this.
> Any help will be greatly appreciated.
> thanks
> kris
> 
> _________________________________________________________________
> Get faster connections -- switch to MSN Internet Access!
> http://resourcecenter.msn.com/access/plans/default.asp
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org


join question

From
"Frank Morton"
Date:
For the SQL gurus, a query where I'm not getting the expected
results. Trying to write it using sql compatible with both postgres
and mysql.
 
There are two tables:
 
table = profile
int id
char name
 
table = attribute
int id
int containerId
char name
char value
 
Multiple attribute rows correspond to a single profile row where
attribute.containerId = profile.id
 
These two queries result in one row being returned, which is
the expected result:
 
select name from profile where ((profile.state='1020811'));

select profile.name from profile,attribute where (((attribute.name='description') and (attribute.value='1020704') and (profile.id=attribute.containerId)));
But, I thought this next query would just be a simple way to combine the two
queries with an "or" operator, still returning one row, actually returns
ALL rows of attribute:

select profile.name from profile,attribute where ((profile.state='1020811') or ((attribute.name='marketsegment') and (attribute.value='1020704') and (profile.id=attribute.containerId)));
 
Why doesn't this last query return just one row?
 
TIA
 

Re: date

From
Tom Lane
Date:
"wishy wishy" <wishy66@hotmail.com> writes:
> we have a PostgreSQL 7.2.2 on i686-pc-linux-gnu, compiled by GCC 2.96
> installation on pogo linux 7.2
> we are facing a data problem when we do the following
> select to_char(to_date('1969-10-22','YYYY-MM-DD'),'YYYY-MM-DD');

> ERROR:  Unable to convert date to tm

Recent versions of glibc broke mktime() for dates before 1970.
There is a workaround for this silliness in Postgres 7.2.3.
        regards, tom lane


Re: join question

From
Stephan Szabo
Date:
On Fri, 18 Oct 2002, Frank Morton wrote:

> For the SQL gurus, a query where I'm not getting the expected
> results. Trying to write it using sql compatible with both postgres
> and mysql.
>
> There are two tables:
>
> table = profile
> int id
> char name
>
> table = attribute
> int id
> int containerId
> char name
> char value
>
> Multiple attribute rows correspond to a single profile row where
> attribute.containerId = profile.id
>
> These two queries result in one row being returned, which is
> the expected result:
>
> select name from profile where ((profile.state='1020811'));
>
> select profile.name from profile,attribute where
> (((attribute.name='description') and (attribute.value='1020704') and
> (profile.id=attribute.containerId)));
>
> But, I thought this next query would just be a simple way to combine the two
> queries with an "or" operator, still returning one row, actually returns
> ALL rows of attribute:
>
> select profile.name from profile,attribute where
> ((profile.state='1020811') or ((attribute.name='marketsegment') and
> (attribute.value='1020704') and (profile.id=attribute.containerId)));
>
> Why doesn't this last query return just one row?

Because for each combination of rows from profile and attribute where
profile.state='1020811' the where clause is statisfied.

I'm not sure what you're precisely trying to get out, since unless the
row that matches each of the clauses is the same I don't see how you'd
only get one row out with an or.




Re: join question

From
Jean-Luc Lachance
Date:
I think you meant:

select profile.name
from profile,attribute
where ( profile.id = attribute.containerId) and ( profile.state =' 1020811' or ( attribute.name = 'marketsegment'
and attribute.value = '1020704');


> select profile.name from profile,attribute where
> ((profile.state='1020811') or ((attribute.name='marketsegment') and
> (attribute.value='1020704') and (profile.id=attribute.containerId)));
> 
> Why doesn't this last query return just one row?
> 
> TIA
>