...

View Full Version : Resolved Put two results of query in one table?



lorraine
05-31-2011, 04:20 AM
Hi. I have the following table:

tblTransaction fields:
transID
bookID
borrowerID
borrowTime
returnTime
duedate
penalty

I have an asp.net listview and I want to have a result with something like this:



SELECT transID, 'Borrowed Book' as Transaction,bookID, borrowTime FROM tblTransaction

This query will give me something like this.
http://i54.tinypic.com/kedpx1.png

and I also need this:


SELECT transID, 'Returned Book' as Transaction,bookId, returnTime FROM tblTransaction

will give me this:
http://i54.tinypic.com/2elcm85.png

What i want is put those two query results in just one table because this is exactly what i needed. Is there a way to do that? Thanks

lorraine
05-31-2011, 10:13 AM
got it. all i need is put a the keyword 'union' in between the queries! :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum