I'm working with a voter history file, and I have a column that contains the number of times each person voted in the last five elections. I'd like to create a second column from that one, giving them rank. (ie - if they voted in 5, they get a "1" if they voted in 4, they get a "2" etc)
Usually I only do this for three elections, and the guy who used to volunteer here had already come up with a code for the query to make it give rank. I've just been using that code, copying and pasting it into my new queries. I don't know SQL offhand, though, at least not well enough to figure out the logic behind the code he's written. It works just fine for three, but I really don't know what it is I'm doing.
This is the code that I have now.
Prime: IIf([PrimeTot]=0,"- ",IIf([PrimeTot]<>2,IIf([PrimeTot]=3,1,3),2))
Here's the thing... I would like someone to help me modify that (or give me something better?) but more importantly, explain what it is you're doing so that I can actually learn it, rather than just mimicking it. I would really appreciate any suggestions.
Thanks so much!!
Usually I only do this for three elections, and the guy who used to volunteer here had already come up with a code for the query to make it give rank. I've just been using that code, copying and pasting it into my new queries. I don't know SQL offhand, though, at least not well enough to figure out the logic behind the code he's written. It works just fine for three, but I really don't know what it is I'm doing.
This is the code that I have now.
Prime: IIf([PrimeTot]=0,"- ",IIf([PrimeTot]<>2,IIf([PrimeTot]=3,1,3),2))
Here's the thing... I would like someone to help me modify that (or give me something better?) but more importantly, explain what it is you're doing so that I can actually learn it, rather than just mimicking it. I would really appreciate any suggestions.
Thanks so much!!
Last edited: