View Single Post

   
  #3 (permalink)  
Old 02-28-2008, 09:35 AM
Jerry Stuckle
 
Posts: n/a
Default Re: should I use join?

mcardeiro@yahoo.com wrote:
> Hi
>
> I am stumped on a select statement. basically I have 2 tables I want
> to use in my select
>
> table1 = "uploads" has fields 'id', 'size'
>
> table 2 = "uploadOwners" has field 'id' which is a foreign key
> referencing uploads.id, and field 'owner'
>
> "uploads"
> +-----+------------+
> | id | size |
> +-----+------------+
> | 1 | 653636 |
> | 2 | 45674 |
> | 3 | 5678 |
> +-----+------------+
>
>
> "uploadsOwners"
> +-----+------------+
> | id | owner |
> +-----+------------+
> | 1 | bill |
> | 2 | john |
> | 3 | john |
> +-----+------------+
>
> basically, I only want to select entries from "uploads" that are
> referenced to uploadOwners.owner="john"
>
> I am at a loss for the proper syntax
>
>
>
> Mike Cardeiro
>



How about something like:

SELECT * FROM uploads
JOIN uploadsOwners ON uploads.id = uploadsOwners.id
WHERE uploadsOwners.owner = 'john';

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Reply With Quote