Search Postgresql Archives

Help Join Tables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux