Click here to Skip to main content
15,887,350 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
My table

Custno---Model---Amount
1010-----Nokia---9500
1020-----Samsung--3200
1030-----Nokia--1200
1040-----Sony----8200
1050-----LG------2000

now i want to display cellphones which has higher price than samsung.

how do i do it ? please help
thanks in advance.
Posted
Updated 11-Jun-15 0:54am
v3
Comments
Mehdi Gholam 11-Jun-15 5:59am    
Get the "samsung" price and compare prices to that value.
raj@hardWork 11-Jun-15 6:16am    
can you please show me how to code that in mysql? i'm quite new to this
thanks in advance

1 solution

This is trivial, study http://www.w3schools.com/sql/sql_where.asp[^] and you should be to construct the sql statement that meets your need.
A template will help:
SQL
select columns from table1 where pricecolumn >
(select pricecolumn from table1 where namecolumn = "modelname")
 
Share this answer
 
v2
Comments
raj@hardWork 11-Jun-15 7:47am    
Thank you so much it did help me

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900