Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    May 2011
    Location
    Philippines
    Posts
    12
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Put two results of query in one table?

    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:

    Code:
    SELECT transID, 'Borrowed Book' as Transaction,bookID, borrowTime FROM tblTransaction
    This query will give me something like this.


    and I also need this:
    Code:
    SELECT transID, 'Returned Book' as Transaction,bookId, returnTime FROM tblTransaction
    will give me this:


    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
    Last edited by lorraine; 05-31-2011 at 09:14 AM. Reason: solved!

  • #2
    New Coder
    Join Date
    May 2011
    Location
    Philippines
    Posts
    12
    Thanks
    2
    Thanked 0 Times in 0 Posts
    got it. all i need is put a the keyword 'union' in between the queries!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •