im trying to build a select query with fields from two tables and also other fields which do not exist in my DB. E.g. emtpy fields or fields with particular text like 'not available'
for example my query looks like this:
select
Product.id,
Product.component_number,
Product_discount.price,
from Product
left join Product_discount ON Product_discount.id = Product.id
where
Product.deleted = 0
Now in the same query I want to add fields that do not exist like:
Codenumber >> should always be emtpy
Factor >> should always contain the text 'Yes' for every row
idea is to build a query that is identical to an import file
Thanks...
CodePudding user response:
You can try this:
select
Product.id,
Product.component_number,
Product_discount.price,
'' as Codenumber,
'Yes' as Factor
from Product
left join Product_discount ON Product_discount.id = Product.id
where Product.deleted = 0;
Thank you