Re: Obtaining two rows from two different columns in same table

From: Lew Pitcher <lew.pitcher_at_digitalfreehold.ca>
Date: Wed, 29 Apr 2015 12:21:05 -0400
Message-ID: <Sx70x.397407$Xj5.192536_at_fx26.iad>


On Wednesday April 29 2015 11:20, in comp.databases.mysql, "MacMax" <macmax_at_nospam.it> wrote:

> Someone can help me?
>
> In one table (rel) i have this structure.
> All three fields are numeric.
>
> id, co1, co2
>
> In another table (users) i have the names...
> id_co, name
> id_co, name
> etc.
>
> I would like this result:
>
> id, name (co1)
> id, name (co2)

How are the two tables related? For that matter, how are the two tables defined? Your DDL (SQL that defines the tables - Data Definition Language) would be of help here.

> How i can get this?

Typically, through a table join. But, it depends on how your tables are defined, specifically with regards to (foreign) keys.

Show us your table definitions, and we can help with the query SQL.

-- 
Lew Pitcher
"In Skills, We Trust"
PGP public key available upon request
Received on Wed Apr 29 2015 - 18:21:05 CEST

Original text of this message