• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 420
  • Last Modified:

"IN" sql query returning Empty set

The following sql query (simplified to get relevant with the error) -
"select tbldt.* from tabl tbldt where tbldt.DatingID in ( 63, 64, 67, 50)"
returns empty set, Although the table tabl contains the record with DatingID 67 .
Actually it should return  all the rows  having DatingID like anythng in the list.

Thanks & Regards,
1 Solution
your query is correct
are you sure that DatingID is a number and not a string? maybe it's a conversion issue
Haris DjulicCommented:
try like this :

"select tbldt.* from tabl tbldt where rtrim(bldt.DatingID) in ( '63', '64', '67', '50')"
If the above doesn't correct it, I'd suggest posting the entire query in case you omitted a part that is causing the incorrect result set.
A proven path to a career in data science

At Springboard, we know how to get you a job in data science. With Springboard’s Data Science Career Track, you’ll master data science  with a curriculum built by industry experts. You’ll work on real projects, and get 1-on-1 mentorship from a data scientist.

Hi Jack,

See what happens if you just do
"select .* from tbldt where tbldt.DatingID in ( 63, 64, 67, 50)"

Good Luck!

Jack020800Author Commented:
Thanks for the all the post here, I reformation of the main wuery has solved the problem.

Thanks & Regards,
Haris DjulicCommented:
than assign and close the question....;)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now