Questions tagged [sql-in]

`SQL IN` operator allows us to specify multiple values in a WHERE clause.

SQL IN operator allows us to specify multiple values in a WHERE clause.

simple syntax:

SELECT * 
FROM PERSON
WHERE ID IN (1, 5, 10)

Reference

222 questions
-1
votes
1 answer

How to sort records according to values provided in "IN" clause

I want to fetch records from a table using the sequence provided in "IN" operator select * from table where id in (10, 5, 30) I want this result ID | Name 10 | Xyz 5 | Abc 30 | Jkl but it is actually showing this result ID | Name 5 | Abc 10 |…
-1
votes
3 answers

How can i get record with must match minimum given ids with SQL IN?

I have tables: users: id | name 1 | first name 2 | second name 3 | third name 4 | fourth name projects: id | name 1 | first 2 | second projectInvitees: id | userId | projectId 1 | 1 | 1 2 | 2 | 1 3 | 2 | 2 4 |…
Dhaval
  • 868
  • 12
  • 22
-1
votes
2 answers

MYSQL: how to speed up an sql Query for getting data

I am using Mysql database. I have a table daily_price_history of stock values stored with the following fields. It has 11 million+ rows id symbolName symbolId volume high low open datetime close So for each stock SymbolName there are various daily…
Santhosh
  • 9,965
  • 20
  • 103
  • 243
-1
votes
3 answers

How can I speed up the oracle query? ( where in( bla bla ))

I have 2000 numbers (Uniq Primary Key). I want to get contact information of numbers. My database is Oracle. I use IN(bla,bla) in my query. It works slow because of this. Example My Query: SELECT p.*,t.* FROM PERSONEL p LEFT OUTER JOIN…
Sinan Bay
  • 171
  • 4
  • 12
-1
votes
2 answers

mysql queries whose results are not quite right

I have a database : I want to retrieve data with conditions where the card number is 7689, with product ID 73 or 71. $this->cekModel->where('card_number', 7689)->where('id_product ', '73')orWhere('id_product', '71')->FindAll(); The result must…
Riska Nanda
  • 129
  • 2
  • 13
-1
votes
2 answers

How can query be optimized?

I have a simple select query on a table, but with different values in LIKE operator. Query is as follows: SELECT * FROM BatchServices.dbo.TaskLog WHERE EntryTime BETWEEN '20190407' AND '20190408' AND TaskGroup LIKE '%CSR%' AND (LogText…
shary.sharath
  • 649
  • 2
  • 14
  • 29
-1
votes
3 answers

SQL: choose one categorical value and exclude others

I have a table of patient ID and the medication they use. If patient fails drug A they will use B, while further drug resistance leads to drug C, and so on. I want to find out patients who use certain drug(i.e. 'B') and stopped there without trying…
Yu Wang
  • 11
  • 2
-2
votes
1 answer

How to check array values using IN operator?

I have a table where each cell in columns has an array list. COL1 COL2 row1: ('hi','hello') ('hi','hello') row2: ('hihi','below') ('pi','by') I am trying to use an in operator on such data but my query is not…
LalaLand
  • 139
  • 3
  • 14
-2
votes
2 answers

Using oracle sql in like together

I`m trying to find results between two different tables. Query is like below select * from atable where acolumn like in (select bcolumn from btable) Acolumn is like someid_123 and Bcolumn is like someid with these datas i cant use only in…
özgür
  • 3
  • 1
-2
votes
3 answers

How to find which values are not in a column from the list?(SQL)

I have a list of values: ('WEQ7EW', 'QWE7YB', 'FRERH4', 'FEY4B', .....) and the dist table with a dist_name column. and I need to create SQL query which would return values from the list which don't exist in the dist_name column.
-2
votes
1 answer

sql - IN, JOIN or EXISTS for filtering

I have the following two entities: project(identifier, name, ...) member(identifier, name, ...) They are joined by the following table: project-member(project_identifier, member_identifier) What is the most common way to find out which projects a…
John Riope
  • 25
  • 6
-3
votes
2 answers

SQL Joining another table with condition

I have two tables given below service table serviceid serviceName title isrestricted --- -------------- ------ ---------- 1 abc t1 0 2 asd t2 1 3 …
sandeep.mishra
  • 825
  • 4
  • 19
  • 40
1 2 3
14
15