Tuesday, 20 August 2013

how can i used union in mysql or tsql/mssql

how can i used union in mysql or tsql/mssql

SELECT
infra_hist.trans_no,
infra_hist.trans_type,
infra_hist.pc_id,
infra_hist.item_number,
infra_hist.date_received,
infra_hist.date_checked,
infra_hist.checked_by,
infra_hist.date_finished,
infra_hist.date_deployed,
infra_hist.trouble_task,
infra_hist.action_taken,
infra_hist.illegal_files,
infra_hist.pcid_to,
infra_hist.remarks,
infra_hist.date_transacted,
infra_hist.transacted_by,
infra_hist.software_id,
infra_hist.item_to,
infra_item.item_desc,
infra_soft.software_desc,
1 as allowedit
FROM
infra_hist
LEFT JOIN infra_item ON infra_hist.item_number = infra_item.item_number
LEFT JOIN infra_soft ON infra_hist.software_id = infra_soft.software_id
WHERE
infra_hist.trans_type = :ra_transtype
UNION
select
infra_softwareavail.pc_id
infra_softwareavail.software_id
infra_softwareavail.product_key
from
infra_softwareavail
this is my code my concern is how can i union this two table..

No comments:

Post a Comment