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.
| Author |
Topic |
|
fmardani
Constraint Violating Yak Guru
433 Posts |
Posted - 2005-07-01 : 06:04:20
|
| There are two tables. TableA, TableBboth have one of the fields called FeedID.The FeedID is a varchar(10)I would like to delete the FeedID in TableB which are not present in TableA.In tableB one of the records has FeedID = '20122783'This FeedID is not present in Table A so I would like to delete this record from TableBThis is the sql that I am using but it does not return this FeedID????delete from TableBwhere FeedID not in (select FeedID from TableA)Thanks |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-07-01 : 06:15:39
|
Make sure this returns the required IdsSelect FeedId from TableBwhere FeedID not in (select FeedID from TableA) MadhivananFailing to plan is Planning to fail |
 |
|
|
fmardani
Constraint Violating Yak Guru
433 Posts |
Posted - 2005-07-01 : 06:17:41
|
| i have already tried that, and it does not return anything. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-07-01 : 06:20:42
|
| Post the table structures with sample dataMadhivananFailing to plan is Planning to fail |
 |
|
|
fmardani
Constraint Violating Yak Guru
433 Posts |
Posted - 2005-07-01 : 06:23:56
|
| How can I compare fiel1, fiel2 in TableA to those in TableB?Thanks |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-07-01 : 06:43:03
|
Use inner JoinSelect T1.field1 from tableA t1 inner join tableB t2 on t1.field1=t2.field1and t1.field2=t2.field2 MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|