Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

removing doubles from results

anniedannied Posts: 1Member
I have a sql question relating to a music store's database that reads

"List the product name, artist and price of all items that are only available in CD format, not 12 inch record"

There are doubles that occur because they are avail on both cd an 12". i need to somehow write a query to just select the songs that are only avail on cd. How do i do it??.

'format' is the column for cd or 12'. i have no control over how the database is configured. the column is 'format', and the value is either 'cd' or '12'. i cant change that

i dont know how to compare the rows.

Comments

  • JonathanJonathan Posts: 2,914Member
    : I have a sql question relating to a music store's database that reads
    :
    : "List the product name, artist and price of all items that are only available in CD format, not 12 inch record"
    :
    : There are doubles that occur because they are avail on both cd an 12". i need to somehow write a query to just select the songs that are only avail on cd. How do i do it??.
    :
    : 'format' is the column for cd or 12'. i have no control over how the database is configured. the column is 'format', and the value is either 'cd' or '12'. i cant change that
    :
    : i dont know how to compare the rows.

    Hi,

    Could you do something like:-

    SELECT artist, title, label, price
    FROM stock
    WHERE format = 'CD' AND COUNT(*) >= 2
    GROUP BY artist, title, label

    Jonathan



    ###
    # Example Of Perl 6 Syntax.
    push @will, my Power $button;
    my $hardware is Useless but Valuable;
    do ($nothing) while $i.work and print $stuff;
    push (@will, my Off $button) and die "with me";

Sign In or Register to comment.