mysql - I don't know how to query in SQL -


i have table t1, 2 columns c1 , c2, in these columns there numbers , can repeated. sample:

c1 | c2 ------- 10 | 8 11 | 8 12 | 10 10 | 2 11 | 10 14 | 2 

i need find number of column c1 has value of 8 , 2 in column c2. in case of sample query should return 10. have explained? can me out?

the easiest way be

select  c1 table_name c2 in (2,8) group c1 having count(*) = 2  

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -