Select * question

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Select * question

Post by Benjamin »

Is it possible to write a query which contains joins, that would select * from 1 table, and only specific fields from other tables?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

yes

Code: Select all

select
      a.*,
      b.xyz
FROM
    tableA as a
JOIN
    tableB as b
ON
  a.id=b.id
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Yes.

Code: Select all

SELECT t.*, r.ride_id FROM time_table t INNER JOIN ride_table r ON t.ride_id = t.ride_id;
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

Ok great, thanks guys.
Post Reply