MySQL

Moderators: Jonathan
Number of threads: 259
Number of posts: 514

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
removing doubles from results Posted by annied on 28 Apr 2003 at 11:30 PM
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.
Report
Re: removing doubles from results Posted by Jonathan on 30 Apr 2003 at 2:27 AM
: 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";




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.