Results 1 to 2 of 2

Thread: Advanced SQL

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2006
    Posts
    137

    Advanced SQL

    Hi,

    I hope this is the most appropriate forum.. but I have two tables I looking for advise on the best method to collect data from both tables using an advanced SQL technique.

    tblTransaction:
    tID
    tDescription
    tCatID
    tUser

    tblCategory:
    cID
    cName

    Basically i'm using
    SELECT* FROM tblTransaction WHERE tUser='username';

    To list all transactions by this user, but rather than getting the category ID (tCatID) I want to get the category name from tblCategory. So for each transaction the category name is given.

    ANy pointers would be great.,?

    Thanks

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Advanced SQL

    What you're looking for is a join.

    Code:
    Select *
    From tblTransaction T
    Inner join tblCategory C
      On t.tCatID = C.cID
    Where t.tUserc='username'
    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

Posting Permissions

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



Click Here to Expand Forum to Full Width