SELECT VoteTypeId AS vcol
FROM VoteType v
WHERE v.VoteTypeId = 4
and table structure is
vcol VoteType
----------- --------------------------------------------------
1 Yes/No
2 Multiple Choice
4 Qualitative
but it turn out error and said Unknown column ‘VoteTypeId’ in ‘where clause’
thanks in advance.
It looks like your alias is not set up reversed (but it’s not entirely clear from your question), and you can’t do it that way. You can’t use the alias in the where clause.
If the real column name is
vcol:See Can you use an alias is a
WHEREclause in MySQL for an explanation/links regarding why you can’t use the alias in theWHERE.