\caption and \label for a LaTeX table

When using both \caption and \label for a LaTeX table, always put \caption before \label; otherwise the labels may not refere the right thing.

For example, use

\begin{table}
  \begin{tabular}{lll}
   ...
  \end{tabular}
  \caption{Table of maxima and minima}
  \label{tab:MaxMinTable}
\end{table}

and not

\begin{table}
  \begin{tabular}{lll}
   ...
  \end{tabular}
  \label{tab:MaxMinTable}
  \caption{Table of maxima and minima}
\end{table}

A simple way to remember this to note that caption comes before label alphabetically.