Inaccurate table numbering with LyX

I'm using LyX to create some tables, but the numbering is complete borked.

In the LyX window, the table numbers are accurate. However, when I render to a PDF, they are evens only: 2, 4, 6 etc. (I'm sure I don't need to explain what even numbers are, but you get the point).

Delving into the source code generated:

\selectlanguage{english}%
~\foreignlanguage{british}{}
\begin{table}[H]
\begin{raggedright}
\begin{longtable}[l]{|r|>{\raggedright}m{0.8\textwidth}|c|}
\hline
\selectlanguage{british}%
No.\selectlanguage{english}%
& \selectlanguage{british}%
Requirement\selectlanguage{english}%
& \selectlanguage{british}%
Priority\selectlanguage{english}%
\tabularnewline
\hline
&  & \tabularnewline
\hline
&  & \tabularnewline
\hline
&  & \tabularnewline
\hline
&  & \tabularnewline
\hline
&  & \tabularnewline
\hline
&  & \tabularnewline
\hline
&  & \tabularnewline
\hline
&  & \tabularnewline
\hline
&  & \tabularnewline
\hline
\end{longtable}
\par\end{raggedright}

\selectlanguage{british}%
\caption{Test table}
\selectlanguage{english}%
\end{table}


This is a test table, hence no data. But, I did notice \begin{table} and \begin{longtable}.

Would I be correct in assuming this is the cause of the problem? If so, does any know how I can go about removing it?

N.b. I've been into the table settings and the long table checkbox is ticked but greyed out, so that's not much use.

-
The syntax should be something like \begin{longtable}[l]{|r|>{\raggedright}m{0.8\textwidth}|c|} \caption{Test table}\\hline(...contents...)\end{longtable}. –  Gonzalo Medina Apr 11 '13 at 19:14

The generated code is full of redundant (or even wrong) things. I don't understand why continuously switching between english and british, for instance: a document should use one English variety, either AmE or BrE.

Using longtable inside a table environment is completely useless. Just a tabular will do. And this is the cause of the wrong numbering, by the way.

The raggedright environment doesn't exist and using the environment form is bound to problems.

\begin{table}
\raggedright
\begin{tabular}[l]{|r|>{\raggedright}m{0.8\textwidth}|c|}
\hline
No. & Requirement & Priority \tabularnewline
\hline
&  & \tabularnewline
\hline
&  & \tabularnewline
\hline
&  & \tabularnewline
\hline
&  & \tabularnewline
\hline
&  & \tabularnewline
\hline
&  & \tabularnewline
\hline
&  & \tabularnewline
\hline
&  & \tabularnewline
\hline
&  & \tabularnewline
\hline
\end{tabular}

\caption{Test table}
\end{table}

-
Thanks for your answer egreg. I guess this is a prime example why using straight latex would be better. –  kyranjamie Apr 15 '13 at 20:41