I've separated my large tables into other individual files for organization and ease of editing, but I can't seem to reference any of them. Can someone clue me into what is going on?
main.tex
\documentclass{report}
\begin{document}
\input{a.tex}
Table~\ref{tab:test}
\end{document}
a.tex
\begin{table}[!htb]
\centering
\caption{ Test }
\label{test}
\end{table}
My understanding is that if the label isn't duplicated I should be able to reference this. Without it turning into ??
** Update **
Even the xr package doesn't seem to help as other answers have suggested.
\documentclass{report}
\usepackage{xr}
\externaldocument[a-]{a}
\begin{document}
\input{a.tex}
Table\ref{a-test}
\end{document}


\label{test}after\caption{ Test }. – Nov 04 '18 at 04:01\label{test}but do\ref{tab:test}. Use\label{tab:test}instead. – Nov 04 '18 at 04:20\input. Keeping the table within the same file works but is undesirable. – JME Nov 04 '18 at 04:33