Check out example codes for "create query in where clasue". It will help you in understanding the concepts better.

Code Example 1

"Select * from s_custom_references where
                article IN (SELECT ordernumber from s_articles_details where articleID = ".$articleID.") ORDER BY updated_at DESC LIMIT 5 "

Learn ReactJs, React Native from akashmittal.com