Quantcast
Channel: SQL Server Reporting Services, Power View forum
Viewing all articles
Browse latest Browse all 20764

combining two queries

$
0
0

Hi, I've got two queries, with the only key between them mailgroupid.

// first query finds everyone added to the mailgroup within jan 2013

SELECT gtMailGp.Firstname, gtMailGp.Surname, gtMailGp.address, gtMailGp.city, gtMailGp.prov, gtMailGp.postalcode, gtMailGp.adddate, gtMailGp.gtPromoID, gtMailGp.gtMailGpNUM
FROM gtMailGp
WHERE (((gtMailGp.adddate)>#1/1/2013# And (gtMailGp.adddate)<#2/1/2013#));

// Second query finds everyone who has booked 

SELECT gtClient.firstname, gtClient.surname, GtBook.bookdate, gtTour.description, gtClient.gtMailGpNUM
FROM (GtBook INNER JOIN gtClient ON GtBook.gtClientNUM = gtClient.gtClientNUM) INNER JOIN gtTour ON GtBook.gtTourNUM = gtTour.gtTourNUM;


// gtMailGpNUM is the key within the client file, and mailgroup file.

I'd like to have one table with everyone who has been added to the mailgroup (within Jan 2013), and entries for those people who have booked.

Not sure how to create a union between the two queries.

Thanks,
Joe


Viewing all articles
Browse latest Browse all 20764


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>