Re: Retrieving 'Credit' when 'C'
От | Phillip Smith |
---|---|
Тема | Re: Retrieving 'Credit' when 'C' |
Дата | |
Msg-id | 004001c7514a$daf02730$9b0014ac@wbaus090 обсуждение исходный текст |
Ответ на | Re: Retrieving 'Credit' when 'C' ("Ezequias Rodrigues da Rocha" <ezequias.rocha@gmail.com>) |
Ответы |
Re: Retrieving 'Credit' when 'C'
("Ezequias Rodrigues da Rocha" <ezequias.rocha@gmail.com>)
|
Список | pgsql-sql |
<div class="Section1"><p class="MsoNormal" style="text-autospace:none"><font face="Courier New" size="2"><span style="font-size:10.0pt;font-family:"CourierNew"">SELECT when,</span></font><p class="MsoNormal" style="margin-left:36.0pt;text-indent:36.0pt;text-autospace: none"><font face="Courier New" size="2"><span style="font-size:10.0pt;font-family: "Courier New"">CASE WHEN type = 'C' THEN 'Credit' END AS type</span></font><p class="MsoNormal" style="text-autospace:none"><fontface="Courier New" size="2"><span style="font-size:10.0pt;font-family:"Courier New"">FROM mytable;</span></font><p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10.0pt;font-family:Arial;color:navy"> </span></font><p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10.0pt;font-family:Arial;color:navy">Assuming your column names are actually “when” and “type” you should just have to change“mytable” to the correct table name and run in psql or the SQL Window of pgAdmin or wherever you usually run your SQLqueries to get what you want.</span></font><p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10.0pt;font-family:Arial;color:navy"> </span></font><p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10.0pt;font-family:Arial;color:navy"> </span></font><p class="MsoNormal" style="margin-left:36.0pt"><font face="Tahoma" size="2"><spanlang="EN-US" style="font-size:10.0pt;font-family:Tahoma">-----Original Message-----<br /><b><span style="font-weight:bold">From:</span></b>pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.org] <b><spanstyle="font-weight:bold">On Behalf Of </span></b>Ezequias Rodrigues da Rocha<br /><b><span style="font-weight:bold">Sent:</span></b></span></font><font face="Tahoma" size="2"><span lang="EN-US" style="font-size:10.0pt;font-family:Tahoma">Friday,16 February 2007</span></font><font face="Tahoma" size="2"><span lang="EN-US"style="font-size:10.0pt;font-family:Tahoma"> </span></font><font face="Tahoma" size="2"><span lang="EN-US" style="font-size:10.0pt;font-family:Tahoma">03:45</span></font><fontface="Tahoma" size="2"><span lang="EN-US" style="font-size:10.0pt;font-family:Tahoma"><br/><b><span style="font-weight:bold">To:</span></b> Ezequias Rodrigues da Rocha;pgsql-sql@postgresql.org<br /><b><span style="font-weight:bold">Subject:</span></b> Re: [SQL] Retrieving 'Credit' when'C'</span></font><p class="MsoNormal" style="margin-left:36.0pt"><font face="Times New Roman" size="3"><span style="font-size:12.0pt"> </span></font><pclass="MsoNormal" style="margin-left:36.0pt"><font face="Times New Roman" size="3"><spanstyle="font-size:12.0pt">Just a question, where to put it ? I didn't notice yet. </span></font></div><br /><p><b>*******************Confidentialityand Privilege Notice*******************</b><p> The material contained in this messageis privileged and confidential to the addressee. If you are not the addressee indicated in this message or responsiblefor delivery of the message to such person, you may not copy or deliver this message to anyone, and you shoulddestroy it and kindly notify the sender by reply email. <p> Information in this message that does not relate to theofficial business of Weatherbeeta must be treated as neither given nor endorsed by Weatherbeeta. Weatherbeeta, its employees,contractors or associates shall not be liable for direct, indirect or consequential loss arising from transmissionof this message or any attachments <br />
В списке pgsql-sql по дате отправления:
Предыдущее
От: Tom LaneДата:
Сообщение: Re: "for SELECT DISTINCT, ORDER BY expressions must appear in select list" - is that the standart or a limitation of postgresql?
Следующее
От: "Walter Cruz"Дата:
Сообщение: Re: "for SELECT DISTINCT, ORDER BY expressions must appear in select list" - is that the standart or a limitation of postgresql?