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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to make a union querie? 1

Status
Not open for further replies.

PLV

Programmer
Apr 29, 2001
15
US
I am trying to do a union query between 2 tables.

I used to make my querie with the GetDefaultSQL and m_srtFilter of the CRecordset class.

I cannot figure how to make an sql query like this:
SELECT ** FROM A WHERE X=X UNION SELECT *** FROM B WHERE Y=Y

Thx
 
learn SQL John Fill
1c.bmp


ivfmd@mail.md
 
The trouble is not really the sql thing is how to write it in C++. The SQL query is exactly the the query I wrote before.

I just don't know how to write this un C++... do you JohnFill?!?!?

If you still don't understand what I don't understand it's: if I try to put this query my m_strFilter would look like "x=x union select *** from B where........" and this looks a bit dumb to me.

Or if you could just explain me how do I use the CDatabase object or the CQueryDef object to make a "UNION" query?

Thx for your time
 
CQueryDef x;
...
x.Open("select... from .. union ....."); John Fill
1c.bmp


ivfmd@mail.md
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top