
November 24th, 2000, 03:28 PM
|
|
Contributing User
|
|
Join Date: Dec 2002
Posts: 14,575
  
Time spent in forums: < 1 sec
Reputation Power: 22
|
|
|
Count Property-Multiple Values in Same Field Not Working
<i><b>Originally posted by : chris (chrisveres@yahoo.com)</b></i><br />I need to count different values from the same field and have them print out four separate counts. I also need to be able to sort these by Site ID. Here is how my data looks:<br /><br />X SiteID<br />---------------- ---------------------<br />3 35012<br />3 12345<br />3 35012<br />1 35012<br />1 35012<br />3 35012<br />2 35012<br />2 12345<br /><br />So for example, I need to be able to count all the three’s, two’s, and one’s WHERE ((Tbl.SiteID)= '35012') and display the count results individually <br /> <br />Example <br />Report for Site ID “35012”<br /><br />Value 3 = 3 Records<br />Value 2 = 1 Record<br />Value 1 = 2 Records<br /><br />This is the code we are using that isn’t working :<br /><br />sql = "SELECT COUNT(DECODE(x,1,1,NULL)) count_of_1, COUNT(DECODE(x,2,1,NULL)) count_of_2, COUNT(DECODE(x,3,1,NULL)) count_of_3 FROM FinLog.AppSta WHERE ((Tbl.SiteID)= '35012')"<br /><br /><br />PLEASE HELP!!!!<br /><br />
|