Skip to content
Advertisement

Constant field has to be set MySQL

Attribute ‘Territory program’ is a constant field and has to be set to ‘Territory and Quota Program’ constant in result set, I don’t want to add a new column in table, so how can I do that in my select statement if possible? Also I have a column Status…

not distributed – if data exists but not distributed to employee yet.

Distributed- if data exists and distributed to employee

approved – if employee approves rejected – if employee rejects

columns Distributed, Accepted in Territory_Header determines.

So far my code looks like this.

Select user.p,user.e,CONCAT(user.p,user.pl,user.role) AS Territories, date_format(user.snapshot_date, '%d/%m/%y') As Startdate,date_format(user.refresh_date,'%d/%m/%y') As EndDate

Advertisement

Answer

Just add a litteral value to the select list:

select 
    user.p,
    user.e,
    concat(user.p,user.pl,user.role) AS Territories, 
    date_format(user.snapshot_date, '%d/%m/%y') As Startdate,
    date_format(user.refresh_date,'%d/%m/%y') As EndDate,
    'Territory and Quota Program' territory_program
from ...
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement