943,962 Members | Top Members by Rank

Ad:
  • MySQL Discussion Thread
  • Unsolved
  • Views: 506
  • MySQL RSS
Oct 2nd, 2009
0

Mysql query

Expand Post »
Hai,

I am developing a home appliances website. I had a detail database. Which stored the details of all the items in that shop. The columns are Id number, name, price, type, made, date.

When user clicks on the TV menu in the website then the lists of TV in that shop will show. I did that using the mysql query like this

select * from data_base where type="TV";
Working fine. Now I need to do a filter search in this page. That is I need to show a list/menu in that page showing all the TV brands in that shop.
How to display all the brands from a database like this

Type----------------Brand----------------Model No
TV----------------Sony ----------------510
TV ----------------AKAI----------------120
TV----------------Sony ----------------150
TV----------------SAMSUNG----------------840
TV ----------------Sony----------------170

Simply I need to display all the tv brands without repeating the name. If I will use this query models will repeat

select "Brand" from data_base where type="tv";
ie the result will be like this

Sony
AKAI
Sony
SAMSUNG
Sony

But I want a result like this

Sony
AKAI
SAMSUNG


Thanks in advance
Rajeesh
Last edited by rajeesh_rsn; Oct 2nd, 2009 at 6:22 am. Reason: mistake
Similar Threads
Reputation Points: 10
Solved Threads: 0
Posting Whiz in Training
rajeesh_rsn is offline Offline
265 posts
since Sep 2008
Oct 2nd, 2009
0

Re: Mysql query

Use the distinct keyword:
MySQL Syntax (Toggle Plain Text)
  1. SELECT DISTINCT "column_name" FROM "table_name"
Reputation Points: 36
Solved Threads: 57
Posting Whiz
Thirusha is offline Offline
355 posts
since Mar 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in MySQL Forum Timeline: MySQL where statement - comparing attributes from two differen tables
Next Thread in MySQL Forum Timeline: finding the largest numbers





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC