I can’t make a where clause on the IdCell column but i can do an “order by”.
SQL server say error on the column name
select
*, (ISNULL(Table_Adresses.IdCellule, Table_Clients.IdCellule)) as IdCell
from Table_Tickets
left join Table_Postes on Table_Postes.IdPoste = Table_Tickets.IdPoste
left join Table_Adresses on Table_Adresses.IdAdresse = Table_Postes.IdAdressePhysique
left join Table_Clients on Table_Clients.IdClient = Table_Tickets.IdClient
where idtypeticket=2 and
isnull(bcloture,0)=0 and
IdCell =4 --problem here
order by IdCell
Why can’t i make a where on IdCell ?
Thank you
You can’t use your aliased column in this way, you’ll need to do: