New topic: 

Can I do an SQLite join with these table structures?

<http://forums.realsoftware.com/viewtopic.php?t=30457>

       Page 1 of 1
   [ 1 post ]                 Previous topic | Next topic         Author  
Message       martinpaulrice           Post subject: Can I do an SQLite join 
with these table structures?Posted: Tue Oct 13, 2009 10:07 am                   
     
Joined: Wed Apr 11, 2007 1:17 pm
Posts: 107
Location: Signal Mountain, TN              This is the first time I'm trying a 
SQLite join and I'm having no joy after a lot of trying. It's occurred to me 
that I might not even be able to do what I want to here. Among the various 
tables I have in my DB are the following two:

Budget with columns:
BudID integer NOT NULL PRIMARY KEY
BudAcctType varchar
BudAcctName varchar
BudAcctBal currency
BudCurrBal currency
BudMonYr varchar

and Transactions with columns:
TransID integer NOT NULL PRIMARY KEY
TransDate date
TransDesc varchar
TransCheck varchar
TransMemo varchar
TransAt currency
TransFrom varchar
TransTo varchar

The thing that relates them is that Budget.BudAcctName can be found in 
Transactions.TransTo, which contains account names. A given account name is 
only found once in Budget.BudAcctName (which is really a chart of accounts) and 
multiple times in Transactions.TransTo.

I'm creating a report (not with the new report generator) where I'm listing 
transaction account names, but only of two budget types (there are five types 
in all). So when I select the transactions, I only want the account names found 
in Transactions.TransTo if they are of the two account types.

So I thought that if I could select/join Budget.BudAcctType and 
Budget.BudAcctName with Transactions.TransTo (and the other columns from 
Transactions I need for the report), I'd be able to compare the account names 
in Transactions.TransTo with the Budget.BudAcctName. Then I'd see whether the 
account type associated with the BudAcctName is one I wanted or not and then 
proceed accordingly.

So my two questions are: is this doable with a join, and if so, what would be 
the SQLite statements?

All help would be appreciated. Thanks in advance.     
_________________
Martin
Signal Mountain, TN  
                            Top            Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 1 post ]     
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to