[SQL] unsubscribe

2007-03-22 Thread Susan Evans

unsubscribe

--
Susan Evans
Haywood County Schools
NCWISE Coordinator
216 Charles Street
Clyde, NC 28721

828-627-8314 (Phone)
828-627-8277 (Fax)
216 Charles Street
Clyde, NC 28721




---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
  choose an index scan if your joining column's datatypes do not
  match


[SQL] Subqueryes

2007-03-22 Thread Ezequias R. da Rocha

Hi list,

I must add some days (i.e:365) to my current_date and put it in my table 
(an UPDATE). By now, it is simple but my "days to add" is in another table.


How could I do this kind of update

My sql is like this (but is not working):

update myTable
set date = (current_date + (Select daysToAdd from base.Table1 where 
myFKey_id = Table1Id) )

where Expire_Date = now()::Date;


--
Atenciosamente
Ezequias Rodrigues da Rocha


---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
  choose an index scan if your joining column's datatypes do not
  match


Re: [SQL] Subqueryes

2007-03-22 Thread Alvaro Herrera
Ezequias R. da Rocha wrote:
> Hi list,
> 
> I must add some days (i.e:365) to my current_date and put it in my table 
> (an UPDATE). By now, it is simple but my "days to add" is in another table.
> 
> How could I do this kind of update
> 
> My sql is like this (but is not working):
> 
> update myTable
> set date = (current_date + (Select daysToAdd from base.Table1 where 
> myFKey_id = Table1Id) )
> where Expire_Date = now()::Date;

So what is the error message?

-- 
Alvaro Herrerahttp://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org


Re: [SQL] Subqueryes

2007-03-22 Thread Richard Broersma Jr
> 
> update myTable
> set date = (current_date + (Select daysToAdd from base.Table1 where 
> myFKey_id = Table1Id) )
> where Expire_Date = now()::Date;

Does this work: http://www.postgresql.org/docs/8.2/interactive/sql-update.html

UPDATE myTable
SET date = current_date + B.daysToAdd
FROM Table1 B
WHERE myFKey_id = B.Table1Id;

Regards,
Richard Broersma Jr.


---(end of broadcast)---
TIP 6: explain analyze is your friend


Re: [SQL] growth of the database

2007-03-22 Thread Hubertus Freiherr von Fuerstenberg

Karthikeyan Sundaram wrote:

Hi,

Our database is growing fast.  I want to create a cronjob that 
should tell me what is the current size of the database on each day.


   How can I find this from the database? Is there any pre-written 
scripts written by somebody to share?




Hi,
there is an administrative function called pg_database_size(name), as in 
SELECT pg_database_size('mydb'); which returns the disk space used by 
the database with the specified name.


See Chapter 9.20.

cheers,
Hubertus
--
Hubertus v. Fuerstenberg
   MAIL: Fraunhofer Institute for Solar Energy Systems
 Heidenhofstr. 2, 79110 Freiburg, Germany
   PHONE: +49 (761) 4588 5153 FAX: +49 (761) 4588 9286
   EMAIL: [EMAIL PROTECTED]
 --- Quis custodiet ipsos custodes? ---

---(end of broadcast)---
TIP 4: Have you searched our list archives?

  http://archives.postgresql.org


Re: [SQL] Subqueryes

2007-03-22 Thread Ezequias R. da Rocha
Perfect quite nice. I am doing things that I could not believe I could 
do without the community.


Thank you so much.

--
Atenciosamente
Ezequias Rodrigues da Rocha



Richard Broersma Jr escreveu:

update myTable
set date = (current_date + (Select daysToAdd from base.Table1 where 
myFKey_id = Table1Id) )

where Expire_Date = now()::Date;



Does this work: http://www.postgresql.org/docs/8.2/interactive/sql-update.html

UPDATE myTable
SET date = current_date + B.daysToAdd
FROM Table1 B
WHERE myFKey_id = B.Table1Id;

Regards,
Richard Broersma Jr.


---(end of broadcast)---
TIP 6: explain analyze is your friend

  




---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
  subscribe-nomail command to [EMAIL PROTECTED] so that your
  message can get through to the mailing list cleanly


[SQL] Dummy question

2007-03-22 Thread Ezequias R. da Rocha

Hi list,

I must use a select * from some table but i must do a join and it must 
be in the were clause.


I can't put select * from tabel1 as tb1, table2 as tb2
where tb2.id = 2
and tb1.fk_tb2ID = tb2.id

I don't would like to use this select statement because the select 
brings us both columns (all columns) of both tables.


ps: I don't want to put all fields names too.


Can someone tell me if there is any way to put on the select only the 
fields of my first table ?


Regards...

--
Atenciosamente
Ezequias Rodrigues da Rocha


---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
  subscribe-nomail command to [EMAIL PROTECTED] so that your
  message can get through to the mailing list cleanly


Re: [SQL] Dummy question

2007-03-22 Thread Joe
Hi Ezequias,

On Thu, 2007-03-22 at 16:43 -0300, Ezequias R. da Rocha wrote:
> I must use a select * from some table but i must do a join and it must 
> be in the were clause.
> 
> I can't put select * from tabel1 as tb1, table2 as tb2
> where tb2.id = 2
> and tb1.fk_tb2ID = tb2.id

Try 

select tb1.* from tabel1 as tb1, table2 as tb2
where tb2.id = 2
and tb1.fk_tb2ID = tb2.id;

Joe


---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly


Re: [SQL] Dummy question

2007-03-22 Thread Ezequias R. da Rocha

Thank you very much Joe.

Ezequias
Joe escreveu:

Hi Ezequias,

On Thu, 2007-03-22 at 16:43 -0300, Ezequias R. da Rocha wrote:
  
I must use a select * from some table but i must do a join and it must 
be in the were clause.


I can't put select * from tabel1 as tb1, table2 as tb2
where tb2.id = 2
and tb1.fk_tb2ID = tb2.id



Try 


select tb1.* from tabel1 as tb1, table2 as tb2
where tb2.id = 2
and tb1.fk_tb2ID = tb2.id;

Joe


---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly

  



--
Atenciosamente
Ezequias Rodrigues da Rocha


---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
  subscribe-nomail command to [EMAIL PROTECTED] so that your
  message can get through to the mailing list cleanly