| | |
Mysql query
Please support our MySQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Sep 2008
Posts: 138
Reputation:
Solved Threads: 0
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
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
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
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
Use the distinct keyword:
MySQL Syntax (Toggle Plain Text)
SELECT DISTINCT "column_name" FROM "table_name"
Life... Is a Moment
![]() |
Similar Threads
- wxpython, mysql query (Python)
- How do i echo a variable in a php mysql query ? (PHP)
- test mysql query for no results (PHP)
- Double MySQL Query (PHP)
- MySQL query's (MySQL)
- Change MySQL Query Timeout Period (MySQL)
Other Threads in the MySQL Forum
- Previous Thread: MySQL where statement - comparing attributes from two differen tables
- Next Thread: finding the largest numbers
| Thread Tools | Search this Thread |
agplv3 alfresco amazon api artisticlicense aws bizspark breathalyzer camparingtocolumns changingprices cmg communityjournalism contentmanagement contractors copyright count court crm database design developer development distinct drupal dui ec2 email enterprise eudora facebook form foss gartner gnu government gpl greenit groupware hiring hyperic images innerjoins insert ip joebrockmeier join keyword keywords kickfire laptop law legal license licensing linux maintenance managing mariadb matchingcolumns metron micromanage microsoft microsoftexchange mindtouch montywidenius mozilla multiple music mysql mysqlcolumnupdating mysqldatetimeordermax() mysqlindex mysqlinternalqueries mysqlquery mysqlsearch news open-xchange opendatabasealliance opengovernment opensource oracle penelope priceupdating query referencedesign reorderingcolumns resultset saas select sharepoint simpledb sourcecode spotify sql sugarcrm syntax techsupport thunderbird transparency virtualization





