Where clause to select multiple rows of unique values


/ Published in: SQL
Save to your folder(s)

Where clause to select multiple rows of unique values


Copy this code and paste it in your HTML
  1. --- YOU WANT TO SELECT MULTIPLE ROWS AT ONCE BASED ON UNIQUE VALUES
  2. --- some_id IS THE COLUMN NAME THAT MAY HAVE AN ID THAT YOU WANT TO BASE THE SELECTION ON
  3.  
  4.  
  5. --- IN PLAIN ENGLISH YOU ARE SAYING...
  6. --- SELECT ALL THE ID'S (IN PARENTHESES) FROM THE COLUMN NAMED some_id
  7.  
  8. SELECT * FROM `your_table_name` WHERE some_id IN(1165,1166,1180,1181)

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.