Skip site navigation (1) Skip section navigation (2)

Help Join Tables

From: BlackMage <dsd7872(at)uncw(dot)edu>
To: pgsql-general(at)postgresql(dot)org
Subject: Help Join Tables
Date: 2010-02-08 22:35:06
Message-ID: 27507462.post@talk.nabble.com (view raw or flat)
Thread:
Lists: pgsql-general
Hey,

I'm having some trouble trying to join tables because I'm trying to join
data in a column to a column name. An example looks like this:

Table 1:
field_names(varchar 255) | field_title(varchar 255)
name_field  |  User Name
interest_field | User Interest
number_field | User Number

Table 2:
user_id  |  name_field  |  interest_field  |  number_field
1 |   John   |  Baseball  |  555-5555

For the beginning of a sql query I have "SELECT table2.name_field,
table2.interest_field, table2.number_field, table1.field_title JOIN table1
ON ?????????? WHERE table2.userid=1"

So basically I am trying to match up the column name with the field. Can
anyone help me with this?

Thank

-- 
View this message in context: http://old.nabble.com/Help-Join-Tables-tp27507462p27507462.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


pgsql-general by date

Next:From: Bruce MomjianDate: 2010-02-08 22:44:13
Subject: Re: Re: [GENERAL] FM format modifier does not remove leading zero from year
Previous:From: Michael van der KolffDate: 2010-02-08 21:23:49
Subject: WINDOW functions - proposed addition weight (dp) for percent_rank, cume_dist

Privacy Policy | About PostgreSQL
Copyright © 1996-2013 The PostgreSQL Global Development Group