gtrapp
asked on
Help with SQL
I have a program that generated SQL for a report. I am not sure what "=" is for in the SELECT section of the query. For example, the "ctx_id = v_ctx_basic_info.ctx_id". Not sure what this is doing. The query does do an inner join on two views by using the ctx_id, but what does this statement do "ctx_id = v_ctx_basic_info.ctx_id"? Why do I need it?
SELECT DISTINCT
ctx_id = v_ctx_basic_info.ctx_id,
contract_type_Description = v_ctx_basic_info.contract_type_Description,
custom_1 = v_ctx_basic_info.custom_1,
Company_Name = v_ctx_basic_info.Company_Name,
expriation_date = v_ctx_basic_info.expriation_date,
product_description = v_ctx_basic_info.product_description
FROM
v_ctx_basic_info INNER JOIN v_ctx_custom on (v_ctx_basic_info.ctx_id=v_ctx_custom.ctx_id)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SELECT Superman = v_ctx_basic_info.ctx_id FROM v_ctx_basic_info
would result in:
Superman
|----------|--
1
2