Help with variable declaration

I declared a variable x that gets the count(*) from a table. The table name is also defined as a variable.

What's wrong with this statment :

X=� select count(*) from ${table_name}�

then

y = `${X}${table_name}'

echo ${y}

It throws an error saying count not found.

Please suggest

Are you using backticks (`) in the assignment to y? Or are you using single quotes (')?

If you use (`), then the shell will try to execute the command inside those backticks and assign the output to the variable y. While doing this, the 'select' is admitted by the shell as it is a shell builtin, but 'count' isn't so it tries to look for an executable file named count in your path, fails and throws the error.