This appends b, c .. if there is more than one float in each section.

\documentclass{article}
\makeatletter
\@addtoreset{table}{subsection}
\@addtoreset{figure}{subsection}
\@addtoreset{table}{section}
\@addtoreset{figure}{section}
\renewcommand\thefigure{%
\ifnum\value{subsection}=0 \thesection\else\thesubsection\fi\ifnum\value{figure}>1 \alph{figure}\fi}
\renewcommand\thetable{%
\ifnum\value{subsection}=0 \thesection\else\thesubsection\fi\ifnum\value{table}>1 \alph{table}\fi}
\makeatother
\begin{document}
\listoftables
\section{zzz}
a
\begin{table}[!htp]TTTT\caption{tt}\end{table}
b
\begin{figure}[!htp]FFF\caption{ff}\end{figure}
\subsection{www}
a
\begin{table}[!htp]TTTT\caption{tt tt}\end{table}
b
\begin{figure}[!htp]FFF\caption{ff ff}\end{figure}
aa
\begin{table}[!htp]TTTT\caption{tt tt tt}\end{table}
bb
\begin{figure}[!htp]FFF\caption{ff ff ff}\end{figure}
\end{document}