SQL comparing all values in a many-one table -


i have table follows

column1 column2         1         2     b     2 

i need write sql query go through table , return me column 2 values have both , b in column 1.

try this:

select column2 mytable column1 in ('a', 'b') group column2 having count(distinct column1) = 2 

Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -