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 |
|
achowe
Starting Member
6 Posts |
Posted - 2003-07-23 : 10:08:43
|
| The following query is supposed to increment a count everytime the condition is true..im just not sure about the syntax and the order of the statements etc........Basically, i want to read through the table and everytime the condition is met I want to increment the count..........Can an inner join beused in conjunction with an IF statement, if not are there any other ways of doing this? Thanks guysdeclare @count intselect @count = 0select t2.cust_id, t1.cust_id from unique_cust t1 INNER JOIN unique_cust t2if (t1.dup_code = t2.dup_code)beginselect @count = @count+1end |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2003-07-23 : 11:09:41
|
What are you trying to return? What is your goal? to find out how many duplicates there are in your table?what is the "dup_code" column ? why are you joining the table to itself where dup_code = dup_code?(sorry, lots of questions ... )- Jeff |
 |
|
|
|
|
|