Tayyab
Tayyab

Reputation: 203

SQL statement having in which where clause have multiple values

I want to fill a ComboBox from database but I want two conditions of same column table column Group contain four different values (rawmaterial, formula, packing , Chemical).

I want to select item names of group formula and packing

I am using the following query, but it's not working:

Select itemName from rawMaterial where Group = 'rawmaterial' , 'Packing'

Upvotes: 0

Views: 318

Answers (1)

Raging Bull
Raging Bull

Reputation: 18737

Two alternatives:

  1. Using OR:

    Select itemName from rawMaterial where Group = 'rawmaterial' OR Group= 'Packing'
    
  2. Using IN:

    Select itemName from rawMaterial where Group IN ('rawmaterial' , 'Packing')
    

Upvotes: 2

Related Questions