Note that there are some explanatory texts on larger screens.

plurals
  1. USjdburns
    primarykey
    data
    text
    plurals
    1. This table or related slice is empty.
    1. COI'm such a noob I thought you were referring to MySQL as "Oracle" when you wrote "[r]ank is available in both MS SQL Server and Oracle." Took me a minute to realize my mistake when searches for the MySQL RANK() function came up empty. I don't want to limit myself to MySQL, so seeing how it might be done in SQL Server is still quite helpful. I did notice after pasting your query into sqlfiddle (which I didn't know existed until bluefeet mentioned it in his reply) that the ORDER BY clause needs the DESC keyword to get the top, rather than bottom, subscribers.
      singulars
    2. COThank you for your thorough response. I have only been hacking around with SQL for a few days, and only with the MySQL 5.5 pre-installed on my MBP; seeing alternate solutions to problems I've solved helps a lot--especially when they're written by people who actually know what they're doing. Your MySQL query may not be more concise, but it's more readable than mine, and the SQL Server query is very clean. Thanks also for Fiddle link--I hadn't yet gotten around to finding a scratchpad like that to allow me to play with different RDBMSs. I appreciate you taking the time.
      singulars
    3. CO@FrederickCheung: Ah... excellent point. I'd lost sight of the fact that I was trying to avoid iterating through the entire (massive) array, only with more idiomatic code--which, I now realize, is why I didn't use `find` in the first place.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload