Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Sql to find records existing

Author  Topic 

winned
Starting Member

1 Post

Posted - 2009-04-29 : 02:23:46
TableA
AId AName
---------------
1 AbC
2 Atable
3 ABus

TableB

BId BName
----------------
20 Bac
21 Bqw
22 Bws
23 Bqs

Table C

CId AId BId
---------------------
1 1 20
2 1 21
3 1 22
4 2 20
5 2 21
6 3 23
7 3 21
Let put it this way

AId BId
1 20,21,22,23
2 20,21
3 23,21

Forevery AId, there can be multiple BIds associated to it. So From UI Only the BID's will be send to the database. What I need to know is If the combination of BIds already associated to AID or it exists in the database. If they exist we need to send true or else we need to send false. say for this combination

BIDs

20,22 return false
20,21 return true
20,21,22 return false
23,21 return true

Any Ideas..

Thanks

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-04-29 : 02:26:21
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=81254


E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page
   

- Advertisement -