#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Posts
    2
    Rep Power
    0

    Unhappy I need help on SQL queries pleaseee


    I am writing some queries based on the “PUBS” database that come shipped with the MS SQL Server and I think I have just about fully stretched the limits of my two week old knowledge in SQL. I will list the questions below. I will really appreciate any help.

    1) List the title, publisher name and price for all titles that have a price higher than the average price of all titles from that publisher.
    (I know this requires correlated queries but I don’t fully understand it yet)

    2) List the title ID and number of sales involving each title. If a title has not had any sales yet, the number of sales should be shown as zero.
    (I think an outer join will do the trick, but I’m just not getting the right results)

    3) List the title ID, title of all titles along with the order number and order date of any sales that involve each title. Your results MUST include titles that do not have any sales yet. Put the list in order of title, and then order date.

  2. #2
  3. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,445
    Rep Power
    4539
    There are samples in BOL that are close to what you want to do.

    http://msdn.microsoft.com/library/en...a-ses_9sfo.asp
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Posts
    2
    Rep Power
    0
    Thanks. That was helpful

IMN logo majestic logo threadwatch logo seochat tools logo