Re: PLEASE help ME , HOW TO GENERATE PRIMARY Keys on the fly - Mailing list pgsql-sql
From | andi |
---|---|
Subject | Re: PLEASE help ME , HOW TO GENERATE PRIMARY Keys on the fly |
Date | |
Msg-id | 20060526101207.5C4B35B0B83@svr4.postgresql.org Whole thread Raw |
In response to | PLEASE help ME , HOW TO GENERATE PRIMARY Keys on the fly ("andi" <andi@mobile-elab.com>) |
Responses |
Re: PLEASE help ME , HOW TO GENERATE PRIMARY Keys on the fly
|
List | pgsql-sql |
<div class="Section1"><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial">When I use this syntax</span></font><p class="MsoNormal"><b><font color="blue" face="Courier New" size="2"><spanstyle="font-size:10.0pt;font-family:"Courier New";color:blue;font-weight:bold">select</span></font></b><b><fontface="Courier New" size="2"><span style="font-size:10.0pt;font-family:"CourierNew"; font-weight:bold"> <font color="gray"><span style="color:gray">*</span></font> <font color="blue"><span style="color:blue">from</span></font>TESTER<font color="gray"><span style="color:gray">;</span></font></span></font></b><pclass="MsoNormal"><font face="Courier New" size="2"><span style="font-size:10.0pt; font-family:"Courier New"">I got </span></font><p class="MsoNormal"><font face="Courier New" size="2"><span style="font-size:10.0pt; font-family:"Courier New""> </span></font><p class="MsoNormal"><font face="Courier New" size="2"><span style="font-size:10.0pt; font-family:"Courier New"">TESTERIDPK TESTER_NAME</span></font><p class="MsoNormal"><font face="Courier New" size="2"><spanstyle="font-size:10.0pt; font-family:"Courier New"">10 TESSSS</span></font><p class="MsoNormal"><font face="Courier New" size="2"><span style="font-size:10.0pt; font-family:"Courier New"">90 NAMAAAA</span></font><p class="MsoNormal"><font face="Courier New" size="2"><spanstyle="font-size:10.0pt; font-family:"Courier New"">100 UUUUU</span></font><p class="MsoNormal"><font color="gray" face="Courier New" size="2"><spanstyle="font-size:10.0pt;font-family:"Courier New";color:gray"> </span></font><p class="MsoNormal"><font face="CourierNew" size="2"><span style="font-size:10.0pt; font-family:"Courier New"">In ms sql server 2005 I use this </span></font><p class="MsoNormal"><b><font color="blue" face="CourierNew" size="2"><span style="font-size:10.0pt;font-family:"Courier New";color:blue;font-weight:bold">select</span></font></b><b><fontface="Courier New" size="2"><span style="font-size:10.0pt;font-family:"CourierNew"; font-weight:bold"> rank<font color="gray"><span style="color:gray">()</span></font> <font color="blue"><span style="color:blue">over</span></font><fontcolor="gray"><span style="color:gray">(</span></font><font color="blue"><span style="color:blue">order</span></font><font color="blue"><span style="color:blue">by</span></font> testeridpk <font color="gray"><spanstyle="color:gray">)</span></font> <font color="blue"><span style="color:blue">as</span></font> rank <fontcolor="gray"><span style="color:gray">,</span></font> <font color="gray"><span style="color:gray">*</span></font> <fontcolor="blue"><span style="color:blue">from</span></font> tester<font color="gray"><span style="color:gray">;</span></font></span></font></b><pclass="MsoNormal"><b><font face="Courier New" size="2"><span style="font-size: 10.0pt;font-family:"Courier New";font-weight:bold">I get the result is like this, </span></font></b><p class="MsoNormal"><b><fontface="Courier New" size="2"><span style="font-size: 10.0pt;font-family:"Courier New";font-weight:bold"> </span></font></b><p class="MsoNormal"><font face="Courier New" size="2"><spanstyle="font-size:10.0pt; font-family:"Courier New"">RANK TESTERIDPK TESTER_NAME</span></font><p class="MsoNormal"><font face="Courier New"size="2"><span style="font-size:10.0pt; font-family:"Courier New"">1 10 TESSS</span></font><p class="MsoNormal"><font face="Courier New" size="2"><spanstyle="font-size:10.0pt; font-family:"Courier New"">2 90 NAMAAA</span></font><p class="MsoNormal"><font face="Courier New" size="2"><spanstyle="font-size:10.0pt; font-family:"Courier New"">3 100 UUUUUUUU</span></font><p class="MsoNormal"><font face="Courier New" size="2"><spanstyle="font-size:10.0pt; font-family:"Courier New""> </span></font><p class="MsoNormal"><font face="Courier New" size="2"><span style="font-size:10.0pt; font-family:"Courier New""> </span></font><p class="MsoNormal"><b><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial;font-weight:bold">How in postgres sql I get the same result , please help me, because iam really frustatingwith this duty.</span></font></b><p class="MsoNormal"><b><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial;font-weight:bold"> </span></font></b><p class="MsoNormal"><b><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial;font-weight:bold">Thank you</span></font></b></div>