Mysql query

Reply

Join Date: Sep 2008
Posts: 138
Reputation: rajeesh_rsn is an unknown quantity at this point 
Solved Threads: 0
rajeesh_rsn rajeesh_rsn is offline Offline
Junior Poster

Mysql query

 
0
  #1
Oct 2nd, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 315
Reputation: Thirusha is an unknown quantity at this point 
Solved Threads: 50
Thirusha's Avatar
Thirusha Thirusha is offline Offline
Posting Whiz

Re: Mysql query

 
0
  #2
Oct 2nd, 2009
Use the distinct keyword:
  1. SELECT DISTINCT "column_name" FROM "table_name"
Life... Is a Moment
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC