Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How To Do A Cross Tab
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
01520803
Message ID:
01520905
Views:
34
>>Each county has multiple occurances of precincts. The final result should be a table with one column for each county. In each column should be only one occurance of each precinct in tht county.
>>
>>So, for Adams, assume it had:
>>
>>
>>ADAMS
>>=======
>>PRE 1
>>PRE 1
>>PRE 1
>>PRE 2
>>PRE 2
>>PRE 3
>>PRE 3
>>PRE 3
>>PRE 4
>>
>>
>>the result should be
>>
>>ADAMS
>>=======
>>PRE 1
>>PRE 2
>>PRE 3
>>PRE 4
>>
>
>If they are trully duplicates, then the code I gave you in the very first message should have eliminated them. If you're seeing them, it means they are not true duplicates.
>
>To find out, try
>
>select MailCounty, Precinct, count(*) as cntDups
>from myTable
>where MailCounty = 'ADAMS'
>GROUP BY MailCounty, Precinct
>HAVING COUNT(*) > 1
>
>Do you see your duplicates here?


Thiss is what I got back
MailCounty	Precinct	cntDups
Adams	BERNE A                                           	267
Adams	BERNE B                                           	274
Adams	DECATUR 1                                         	301
Adams	DECATUR 2                                         	269
Adams	GENEVA                                            	191
Adams	MONROE B                                          	137
Adams	NO WASHINGTON                                     	124
Adams	SO MONROE                                         	207
Adams	UNION                                             	142
Adams	WABASH                                            	128
Adams	BERNE C                                           	299
Adams	BLUE CREEK                                        	91
Adams	DECATUR 3                                         	112
Adams	DECATUR 4                                         	207
Adams	DECATUR 5                                         	280
Adams	EAST ROOT                                         	205
Adams	FRENCH                                            	112
Adams	HARTFORD                                          	139
Adams	JEFFERSON                                         	69
Adams	KIRKLAND                                          	189
Adams	MONROE A                                          	21
Adams	Nottingham                                        	2
Adams	PREBLE                                            	170
Adams	SO WASHINGTON                                     	176
Adams	ST MARYS                                          	176
Adams	WEST ROOT                                         	168
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform