Thread: query

query

From
"Chandan_Kumaraiah"
Date:
<div class="Section1"><p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size:
12.0pt"> </span></font><p class="MsoNormal"><b><font face="Tahoma" size="2"><span style="font-size:10.0pt;
font-family:Tahoma;font-weight:bold">Hi,</span></font></b><p class="MsoNormal"><b><font face="Tahoma" size="2"><span
style="font-size:10.0pt;
font-family:Tahoma;font-weight:bold"> </span></font></b><p class="MsoNormal"><b><font face="Tahoma" size="2"><span
style="font-size:10.0pt;
font-family:Tahoma;font-weight:bold">In oracle we write sysdate-1</span></font></b><p class="MsoNormal"><b><font
face="Tahoma"size="2"><span style="font-size:10.0pt; 
font-family:Tahoma;font-weight:bold">For example,we write a query (select * from table1 where
created_date>=sysdate-1).Whatsits equivalent in postgre?</span></font></b><p class="MsoNormal"><b><font
face="Tahoma"size="2"><span style="font-size:10.0pt; 
font-family:Tahoma;font-weight:bold"> </span></font></b><p class="MsoNormal"><b><font face="Tahoma" size="2"><span
style="font-size:10.0pt;
font-family:Tahoma;font-weight:bold">Chandan</span></font></b><p class="MsoNormal"><b><font face="Tahoma"
size="2"><spanstyle="font-size:10.0pt; 
font-family:Tahoma;font-weight:bold"> </span></font></b></div>

Re: query

From
Terry Fielder
Date:
<tt>now() returns a timestamp.<br /><br /> Cast it to a date and then you can subtract days. e.g.<br /><br /> select
now()::date-1<br /><br /> Terry<br /></tt><br /> Chandan_Kumaraiah wrote: <blockquote
cite="mid2EB549AAAFEA264FA926269A5BD5E9EB146579@certsrv.satyam.com"type="cite"><style>
 
<!--/* Font Definitions */@font-face{font-family:Tahoma;panose-1:2 11 6 4 3 5 4 4 2 4;}/* Style Definitions
*/p.MsoNormal,li.MsoNormal, div.MsoNormal{margin:0in;margin-bottom:.0001pt;font-size:12.0pt;font-family:"Times New
Roman";}
a:link, span.MsoHyperlink{color:blue;text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed{color:purple;text-decoration:underline;}
span.EmailStyle17{mso-style-type:personal;font-family:Arial;color:windowtext;}
span.EmailStyle18{mso-style-type:personal-reply;font-family:Arial;color:navy;}
@page Section1{size:8.5in 11.0in;margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1{page:Section1;}
--> </style><div class="Section1"><p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size:
12pt;"> </span></font><pclass="MsoNormal"><b><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family:
Tahoma;font-weight: bold;">Hi,</span></font></b><p class="MsoNormal"><b><font face="Tahoma" size="2"><span
style="font-size:10pt; font-family: Tahoma; font-weight: bold;"> </span></font></b><p class="MsoNormal"><b><font
face="Tahoma"size="2"><span style="font-size: 10pt; font-family: Tahoma; font-weight: bold;">In oracle we write
sysdate-1</span></font></b><pclass="MsoNormal"><b><font face="Tahoma" size="2"><span style="font-size: 10pt;
font-family:Tahoma; font-weight: bold;">For example,we write a query (select * from table1 where
created_date>=sysdate-1).Whatsits equivalent in postgre?</span></font></b><p class="MsoNormal"><b><font
face="Tahoma"size="2"><span style="font-size: 10pt; font-family: Tahoma; font-weight: bold;"> </span></font></b><p
class="MsoNormal"><b><fontface="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma; font-weight:
bold;">Chandan</span></font></b><pclass="MsoNormal"><b><font face="Tahoma" size="2"><span style="font-size: 10pt;
font-family:Tahoma; font-weight: bold;"> </span></font></b></div></blockquote><br /><pre class="moz-signature"
cols="72">--
 
Terry Fielder
<a class="moz-txt-link-abbreviated" href="mailto:terry@greatgulfhomes.com">terry@greatgulfhomes.com</a>
Associate Director Software Development and Deployment
Great Gulf Homes / Ashton Woods Homes
Fax: (416) 441-9085</pre>

Re: query

From
Richard Huxton
Date:
Terry Fielder wrote:
> now() returns a timestamp.
> 
> Cast it to a date and then you can subtract days. e.g.
> 
> select now()::date -1

Or CURRENT_DATE - 1

>>
>> *In oracle we write sysdate-1*
>>
>> *For example,we write a query (select * from table1 where 
>> created_date>=sysdate-1).Whats its equivalent in postgre?*

--  Richard Huxton  Archonet Ltd