Re: [SQL] Triggers

2006-08-22 Thread Kis János Tamás
Hi,

Plesae read my previous message in this mail list,
on 2006-08-15. 14.20 at  [SQL] Undo an update thread.

bye,
kjt


McAfee SCM 4.1 által ellenőrizve!

---(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] to get DD-MM-YYYY format of data

2006-08-22 Thread Penchalaiah P.








Hi .. 



I am using date is data type to one of the field in my table.but
when ever I am passing values to that field it is taking yyy-mm-dd format..

But I dont want like that .. I need like this DD-MM-..
for this wt I have to do



Thanks  Regards

Penchal reddy | Software Engineer


Infinite Computer Solutions | Exciting TimesInfinite Possibilities... 

SEI-CMMI level 5 | ISO 9001:2000

IT SERVICES |
BPO


Telecom | Finance
| Healthcare | Manufacturing
| Energy  Utilities | Retail
 Distribution | Government


Tel +91-80-5193-(Ext:503)| Fax +91-80-51930009 | Cell No +91-9980012376|www.infics.com

Information transmitted by this e-mail is
proprietary to Infinite Computer Solutions and/ or its Customers and is
intended for use only by the individual or entity to which it is addressed, and
may contain information that is privileged, confidential or exempt from
disclosure under applicable law. If you are not the intended recipient or it
appears that this mail has been forwarded to you without proper authority, you
are notified that any use or dissemination of this information in any manner is
strictly prohibited. In such cases, please notify us immediately at [EMAIL PROTECTED] and delete this mail from your records.









Information transmitted by this e-mail is proprietary to Infinite Computer Solutions and / or its Customers and is intended for use only by the individual or the entity to which it is addressed, and may contain information that is privileged, confidential or exempt from disclosure under applicable law. If you are not the intended recipient or it appears that this mail has been forwarded to you without proper authority, you are notified that any use or dissemination of this information in any manner is strictly prohibited. In such cases, please notify us immediately at [EMAIL PROTECTED] and delete this email from your records.


Re: [SQL] to get DD-MM-YYYY format of data

2006-08-22 Thread Michael Fuhr
On Tue, Aug 22, 2006 at 06:46:11PM +0530, Penchalaiah P. wrote:
 I am using date is data type to one of the field in my tablebut when
 ever I am passing values to that field it is taking yyy-mm-dd format..
 
 But I don't want like that .. I need like this DD-MM-.. for this wt
 I have to do...

See Date/Time Input, Date/Time Output, and Data Type Formatting
Functions in the documentation:

http://www.postgresql.org/docs/8.1/interactive/datatype-datetime.html
http://www.postgresql.org/docs/8.1/interactive/functions-formatting.html

-- 
Michael Fuhr

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

   http://archives.postgresql.org


Re: [SQL] to get DD-MM-YYYY format of data

2006-08-22 Thread Alvaro Herrera
Penchalaiah P. wrote:

 I am using date is data type to one of the field in my tablebut when
 ever I am passing values to that field it is taking yyy-mm-dd format..
 
 But I don't want like that .. I need like this DD-MM-.. for this wt
 I have to do...

Read the documentation on the DateStyle parameter, noticing that it
controls two things at once, input and output of dates.

You may also use to_char() or extract() to format the date manually
without messing with the configuration.

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

---(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] joining VIEWs

2006-08-22 Thread Brian Cox
Given a view like:  create view view1 as select g.id as UserGroupId, s.uid as UserId, s.time as StartTime from stats s join groups g on g.uid = s.uid  and a SELECT like:  select a.UserGroupId,b.UserGroupId from view1 a full outer join view1 b on b.UserGroupId = a.UserGroupId WHERE a.StartTime = '2006-1-1' AND a.StartTime  '2007-1-1'  AND b.StartTime = '2005-1-1' AND b.StartTime  '2006-1-1';  where there are 5695 rows in 2006 and 1 row in 2005, I expected to get a result set of 5695 rows, but instead got only 1 row (the common row in the 2 years). This seems contrary to the definition of "full outer join". Am I missing something?  Thanks, Brian Cox 
		Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls.  Great rates starting at 1¢/min.

Re: [SQL] joining VIEWs

2006-08-22 Thread Stephan Szabo
On Tue, 22 Aug 2006, Brian Cox wrote:

 Given a view like:

  create view view1 as
  select g.id as UserGroupId, s.uid as UserId, s.time as StartTime from stats 
 s join groups g on g.uid = s.uid

  and a SELECT like:

  select a.UserGroupId,b.UserGroupId from view1 a
  full outer join view1 b on b.UserGroupId = a.UserGroupId
  WHERE a.StartTime = '2006-1-1' AND a.StartTime  '2007-1-1'
AND b.StartTime = '2005-1-1' AND b.StartTime  '2006-1-1';

  where there are 5695 rows in 2006 and 1 row in 2005, I expected to get
  a result set of 5695 rows, but instead got only 1 row (the common row
  in the 2 years).  This seems contrary to the definition of full outer
  join.  Am I missing something?

The where clause is applied after the join. If you want to filter the rows
before/during the join itself you can use subselects in the from clause or
put the additional conditions in the on condition.


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

   http://archives.postgresql.org


[SQL] SQL92 compliance

2006-08-22 Thread Daniel CAUNE
Hi,

Is AS in SELECT my_column AS my_name FROM my_table mandatory to be SQL92
compliant?

PostgreSQL requires this keyword by default when defining alias, which might
be good thing.  I mean, I would prefer being notified from a syntax error
than spending a couple of hours wondering why a client application, at the
end of a several data marshalling processes, doesn't get the right data...
For instance MySQL doesn't require it and sometimes that sucks:

  SELECT my_column1
 my_column2,
 my_column3
FROM my_table

Regards,


--
Daniel


---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


[SQL] error with mor than 1 sub-select

2006-08-22 Thread chrisj

Hi,

I am fairly new to PostgreSQL but not to SQL.  Is this a bug or a
limitation...

The first query works fine, but when a second sub-query is added I get a
syntax error...

psql protocal2 -U p2user  EOF1
select *
   from serv_res SR
   where serv_key = 10
 and not exists 
(select 1
  from reservation R
)
-- and not exits 
--(select 1 
--   from interval R1
--)
order by 1
;
select *
   from serv_res SR
   where serv_key = 10
 and not exists 
(select 1
   from reservation R
)
 and not exits
(select 1
   from interval R1
)
order by 1
;

EOF1

The output is as follows:

Password for user p2user:
 serv_key | res_key | start_off_min | duration_min
--+-+---+--
(0 rows)

ERROR:  syntax error at or near select at character 192
LINE 9: (select 1
 ^

Note:  This is not the actual query I want to run but just kept removing
complexity until the problem (multiple sub-selects) seemed obvious.
-- 
View this message in context: 
http://www.nabble.com/error-with-mor-than-1-sub-select-tf2149934.html#a5936948
Sent from the PostgreSQL - sql forum at Nabble.com.


---(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] SQL92 compliance

2006-08-22 Thread Michael Glaesemann


On Aug 23, 2006, at 10:40 , Daniel CAUNE wrote:


Hi,

Is AS in SELECT my_column AS my_name FROM my_table mandatory to  
be SQL92

compliant?


You can find this in the documentation:
http://www.postgresql.org/docs/8.1/interactive/sql-select.html#AEN48391


The AS Key Word

In the SQL standard, the optional key word AS is just noise and can  
be omitted without affecting the meaning. The PostgreSQL parser  
requires this key word when renaming output columns because the  
type extensibility features lead to parsing ambiguities without it.  
AS is optional in FROM items, however.


Hope this helps.

Michael Glaesemann
grzm seespotcode net




---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

  http://www.postgresql.org/docs/faq


Re: [SQL] error with mor than 1 sub-select

2006-08-22 Thread Michael Fuhr
On Tue, Aug 22, 2006 at 06:47:51PM -0700, chrisj wrote:
 The first query works fine, but when a second sub-query is added I get a
 syntax error...
 
 psql protocal2 -U p2user  EOF1
 select *
from serv_res SR
where serv_key = 10
  and not exists 
 (select 1
   from reservation R
 )
 -- and not exits 

Does the real query have exits instead of exists?  I created
some test tables and fixed that typo and then both queries worked.

-- 
Michael Fuhr

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

   http://archives.postgresql.org


Re: [SQL] error with mor than 1 sub-select

2006-08-22 Thread Osvaldo Kussama
chrisj [EMAIL PROTECTED] escreveu: Hi,I am fairly new to PostgreSQL but not to SQL.  Is this a bug or alimitation...The first query works fine, but when a second sub-query is added I get asyntax error...psql protocal2 -U p2user  EOF1select *   from serv_res SR   where serv_key = 10 and not exists (select 1  from reservation R)-- and not exits --(select 1 --   from interval R1--)order by 1;select *   from serv_res SR   where serv_key = 10 and not exists (select 1   from reservation R) and not
 exitsexi*S*ts(select 1   from interval R1)order by 1;EOF1The output is as follows:Password for user p2user: serv_key | res_key | start_off_min | duration_min--+-+---+--(0 rows)ERROR:  syntax error at or near "select" at character 192LINE 9: (select 1 ^Note:  This is not the actual query I want to run but just kept removingcomplexity until the problem (multiple sub-selects) seemed obvious.-- View this message in context: http://www.nabble.com/error-with-mor-than-1-sub-select-tf2149934.html#a5936948Sent from the PostgreSQL - sql forum at Nabble.com.[]sOsvaldo 
		 
Yahoo! Search 
Música para ver e ouvir: You're Beautiful, do James Blunt

Re: [SQL] error with mor than 1 sub-select

2006-08-22 Thread chrisj

thanks, stupid user error.

i guess the pointer on the error message led me astray


Michael Fuhr wrote:
 
 On Tue, Aug 22, 2006 at 06:47:51PM -0700, chrisj wrote:
 The first query works fine, but when a second sub-query is added I get a
 syntax error...
 
 psql protocal2 -U p2user  EOF1
 select *
from serv_res SR
where serv_key = 10
  and not exists 
 (select 1
   from reservation R
 )
 -- and not exits 
 
 Does the real query have exits instead of exists?  I created
 some test tables and fixed that typo and then both queries worked.
 
 -- 
 Michael Fuhr
 
 ---(end of broadcast)---
 TIP 4: Have you searched our list archives?
 
http://archives.postgresql.org
 
 

-- 
View this message in context: 
http://www.nabble.com/error-with-more-than-1-sub-select-tf2149934.html#a5937248
Sent from the PostgreSQL - sql forum at Nabble.com.


---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings