Hi
Select distinct T0.code,T0.Name
from Item T0 where T0.ItemCode = (Select distinct(Itemcode) from Item2)
Thanks
Hi
Select distinct T0.code,T0.Name
from Item T0 where T0.ItemCode = (Select distinct(Itemcode) from Item2)
Thanks
Know the answer? Post it. Somebody with the same question will find it here.
Sachin SinghRank #66 · 26.2K reputationPosted May 19, 2022, 12:56 PM EDT
Jignesh KumarRank #91 · 22.9K reputationPosted May 19, 2022, 11:30 PM EDT
Nitin SontakkeRank #264 · 9.6K reputationPosted May 20, 2022, 1:19 PM EDT
Asma KhalidRank #160 · 14.7K reputationPosted May 23, 2022, 1:05 AM EDT
Anoop Kumar SharmaRank #127 · 17.4K reputationPosted May 19, 2022, 11:56 AM EDT
Anoop Kumar SharmaRank #127 · 17.4K reputationPosted May 19, 2022, 12:02 PM EDT
Ramco RamcoRank #462 · 5.4K reputationPosted May 19, 2022, 12:21 PM EDT
Hi ANoop
Actually i want those code which have different in tbl2 of that ItemCode Unique.
Thanks
Onkar SharmaRank #104 · 20.6K reputationPosted Dec 24, 2022, 10:19 AM EST
Hi Ramco,
I totally agree with Anoop, you need to use the "IN" operator otherwise it will give you a "Subquery returned more than 1 record" error message.
When the subquery returns more than 1 value, you must use the IN operator:
Syntax:
Query:
To know more about SQL Server Subqueries, visit:
Thanks!
Uday DodiyaRank #239 · 10.3K reputationPosted Aug 31, 2022, 3:11 AM EDT
Anandu G NathRank #681 · 3.5K reputationPosted Jan 24, 2024, 2:01 AM EST
Rewrite the code using below syntax
Syntax:
Give conditions to subquery
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts