select column by position - Mailing list pgsql-sql
From | Jennifer Lee |
---|---|
Subject | select column by position |
Date | |
Msg-id | BE57D4C018CC2642AF256E2FDDA9095736953B@sims.scri.sari.ac.uk Whole thread Raw |
Responses |
Re: select column by position
|
List | pgsql-sql |
<div class="Section1"><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial">Is there a way to select a column in a table by its position rather than the field name? If I understandcorrectly column position in a table is fixed. I’ve not been able to find anything in the archives or docs to indicatethat it’s possible to select by position.</span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial">For example:</span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial">CREATE TABLE Accessions (</span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial"><span style="mso-spacerun:yes"> </span>accession_id INT8 PRIMARY KEY DEFAULT nextval('accession_id_seq'),</span></font><pclass="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial"><span style="mso-spacerun:yes"> </span>accenumb VARCHAR(255) NOT NULL,</span></font><p class="MsoNormal"><fontface="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial"><span style="mso-spacerun:yes"> </span>instcode_id INT4 NOT NULL CONSTRAINT Accessions_instcode_id_fkREFERENCES Institutions(institution_id),</span></font><p class="MsoNormal"><font face="Arial" size="2"><spanstyle="font-size:10.0pt; font-family:Arial"><span style="mso-spacerun:yes"> </span>accename VARCHAR(255)</span></font><p class="MsoNormal"><fontface="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial">);</span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial">I would like to select accession_id by indicating column 1 somehow. Is this at all possible?</span></font><pclass="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial">Cheers,</span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial">Jennifer</span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial"> </span></font></div><p align="left"><font color="#0000ff"><font color="#000000" face="Tahoma" size="2">*****************************************************************************************</font></font><p align="left"><fontcolor="#0000ff"><font color="#000000" face="Tahoma" size="2"><strong>DISCLAIMER:</strong></font></font><palign="left"><font color="#0000ff"><font color="#000000" face="Tahoma"size="2">This email is from the Scottish Crop Research Institute, but the views expressed by the sender arenot necessarily the views of SCRI and its subsidiaries. This email and any files transmitted with it are confidentialto the intended recipient at the e-mail address to which it has been addressed. It may not be disclosed or usedby any other than that addressee.<br />If you are not the intended recipient you are requested to preserve this confidentialityand you must not use, disclose, copy, print or rely on this e-mail in any way. Please notify <a href="mailto:mail@scri.sari.ac.uk">mail@scri.sari.ac.uk</a>quoting the name of the sender and delete the email from yoursystem.</font></font><p align="left"><font color="#0000ff"><font color="#000000" face="Tahoma" size="2">Although SCRIhas taken reasonable precautions to ensure no viruses are present in this email, neither the Institute nor the senderaccepts any responsibility for any viruses, and it is your responsibility to scan the email and the attachments (ifany).<br /></font></font>