I am trying to count how many times one column is a higher value than another. I do have a running total count by using ++ that does 1-0, 2-0, 2-1, in each column but I would like to do a,
Sum(a > b) as output Where or Count(a > b) as output Where
so the total can be in one cell with a
I have tried just about everything
<?var=$['']?>
or something like that or just a plain
'.$example.' or $example
Thanks for any help.
SELECT COUNT(*) FROM <table> WHERE <col_a> > <col_b>
<table> = the name of the table you want to select data from <col_a> = the name of the column whose value should be higher <col_b> = the name of the column whose value should be lower
Hmmmmm, it was that simple? I have not tried it but sure makes sense. I have done Where for < date or > date, so it makes since.
I am sure it will work. I am just winging it as I have not had any training, just common sense gets me by.
Thanks
OK, for an update and anything else I can do.
It is working BUT, it is sorting the numbers like this: 1,10,11,12,13,14.......2,20,21,22........3,31
So, it keeps saying that 7 is greater than 31.
Any ideas? Maybe tell it to go 2 deimal points?
Changing my numbers to 2 digits does work. So I could change all 1,2,3,4,5,6,7,8,9 to 01,02,03,04,05,06,07,08,09
are you storing integers in a string field?