Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UNION Query On Sql Server

Status
Not open for further replies.

meravsha

Programmer
Jul 27, 2001
21
0
0
IL
I Tried to write a VIEW In Sql Server with UNION Operation
Like this:
"SELECT TblRec.Rc_CodeCliBranch,TblRec.Rc_CodeClient, TblRec.Rc_CodeBranch,TblRec.Rc_CodeRecipt, TblBillRec.BR_Amount AS TotalPay, TblRec.Rc_TotalAmount AS TotalRec
FROM TblBillRec INNER JOIN TblRec ON TblBillRec.BR_CodeRecipt=TblRec.Rc_CodeRecipt AND TblBillRec.BR_CodeReciptBranch=TblRec.Rc_CodeBranch
UNION
SELECT TblRec.Rc_CodeCliBranch,TblRec.Rc_CodeClient, TblRec.Rc_CodeBranch,TblRec.Rc_CodeRecipt,TblRecNegBill.RNB_Amount AS TotalPay, TblRec.Rc_TotalAmount AS TotalRec
FROM TblRecNegBill INNER JOIN TblRec ON TblRecNegBill.RNB_CodeRecipt=TblRec.Rc_CodeRecipt AND TblRec.Rc_CodeBranch=TblRecNegBill.RNB_CodeReciptBranch "

but I got a massage like:
"Query Desiner doas not support UNION Sql Construct"
my question Is how can I Create a UNION Query in Sql Server and save it?
 
I have not been able to get a union query to work in a view. I have always had to put them in a stored proc. and get my recordset from there. You won't be able to use the graphical format for creating the query.
 
meravsha,

You can use a third party sql client, such as the free WinSQL Lite, and create the view.

vince

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top