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 |
|
cat_jesus
Aged Yak Warrior
547 Posts |
Posted - 2001-08-21 : 10:51:48
|
| I have a situation where a cursor solution immediately comes to mind but I am having difficulty finding another solution. Imagine three tables with a field in common, account_no. In each of the three tables the count of records should be equal for any given account_no. Any records that do not fit this requirement must be researched and cleaned up. I have distilled the tables down for clarity.CREATE TABLE [TRANSACTION_LOG] ( [trans] [varchar] (1) NULL , [account_no] [varchar] (10) NULL ) on [primary]CREATE TABLE [CUST] ( [name] [varchar] (100) NULL , [account_no] [varchar] (10) NULL ) on [primary]CREATE TABLE [ITEM_LIST] ( [item] [varchar] (25) NULL , [account_no] [varchar] (10) NULL ) on [primary]Now the first thing that comes to mind for me is to create a cursor using the account_no of the first table, then for each account number and table do:variable = select count(*) from table where account_no = Cursor_account_nothen compare the counts.This seems inherently cumbersome. Can someone help me get over my linear thinking and point me in the right direction? The goal here is to help me think differently, not give me the solution straight away.Cat |
|
|
|
|
|