[Tex/LaTex] How to rotate the large table and caption

tables

I want to rotate a large table with the caption. However, I can not rotate the caption for the table. Do you have any ideas how to rotate the caption for this layout? Thanks a lot.

Here my text code is below

\rotatebox{90}{
% \caption{Comparison} I cannot use this function like that
\begin{tabular}{l*{6}{c}r}
\hline
Names  & A & B & C & D \\
\hline
\hline
Jobs   & A & B & C & D \\
\hline
Types   & A & B & C & D \\
\hline
\end{tabular}    
}

Best Answer

I tried this:

\documentclass{article}
\usepackage{rotating}

\begin{document}

\begin{sidewaystable}
\centering
\caption{Comparison}
\begin{tabular}{l*{6}{c}r}
\hline
Names  & A & B & C & D \\
\hline
\hline
Jobs   & A & B & C & D \\
\hline
Types   & A & B & C & D \\
\hline
\end{tabular}    

\end{sidewaystable}

\end{document}

enter image description here

Related Question