SQL Join a View with a Table

Posted by gamerzfuse on Stack Overflow See other posts from Stack Overflow or by gamerzfuse
Published on 2010-04-08T14:16:03Z Indexed on 2010/04/08 14:23 UTC
Read the original article Hit count: 360

Filed under:
|
|
CREATE VIEW qtyorderedview AS
SELECT titleditors.title_id, titleditors.ed_id, salesdetails.title_id, salesdetails.qty_shipped
FROM  titleditors, salesdetails
WHERE titleditors.title_id = salesdetails.title_id

I am using the above SQL statement to create a view. I need to show Editors First Name, Last Name, City where they shipped more than 50 books. The three tables I have are:

create table editors (
    ed_id       char(11),
    ed_lname    varchar(20),
    ed_fname    varchar(20),
    ed_pos      varchar(12),
    phone       varchar(10),
    address     varchar(30),
    city        varchar(20),
    state       char(2),
    zip     char(5),
    ed_boss     char(11));

create table titleditors (
    ed_id       char(11),
    title_id    char(6),
    ed_ord      integer);

create table salesdetails (
    sonum       integer,
    qty_ordered integer,
    qty_shipped integer,
    title_id    char(6),
    date_shipped    date);

Can anyone tell me what the second Join code would be to create this result? My first view works fine, but I don't know how to join it to the second table to achieve this result? I didn't make the tables, I just have to work with what I was given.

Thanks in advance!

© Stack Overflow or respective owner

Related posts about sql

Related posts about join