Hi José, > I have one more ask for help, imagine almost the same data, > > Class|ProjID|ProjFund|Invoice|PM|Split > Finishers|1045|73||JIC| > Finishers|1045|75|30|LED| > Finishers|1045|75|30|SAN| > Finishers|1045|75|30|JIC| > Finishers|1045|75||ELI| > Finishers|1045|75|75|ELI|y > Finishers|1045|75|25|| > Finishers|1045|73||JIC| > Finishers|1045|73||LED| > Finishers|1045|73||KAP| > Finishers|1045|73|58.4|ELI|y > Finishers|1045|73|||
Building on the normalized version of the database that I posted earlier, you would add a table: create table FundPM ( FundID integer --> Fund.FundID , PM text collate nocase ) ; insert into FundPM ( FundID, PM ) values (1, 'JIC' ); insert into FundPM ( FundID, PM ) values (2, 'LED' ); insert into FundPM ( FundID, PM ) values (3, 'SAN' ); insert into FundPM ( FundID, PM ) values (4, 'JIC' ); insert into FundPM ( FundID, PM ) values (5, 'ELI' ); insert into FundPM ( FundID, PM ) values (6, 'ELI' ); insert into FundPM ( FundID, PM ) values (8, 'JIC' ); insert into FundPM ( FundID, PM ) values (9, 'LED' ); insert into FundPM ( FundID, PM ) values (10, 'KAP' ); insert into FundPM ( FundID, PM ) values (11, 'ELI' ); > I would like to also get the PM value when split = 'y'. Again, you just join the Split table to the columns that you want: select PM from Split left join Invoice on Split.InvoiceID = Invoice.InvoiceID left join FundPM on Invoice.FundID = FundPM.FundID ; I think this has reached the point where it's probably useful for you to explain the bigger picture of your data and what you're trying to do with it. Tom BareFeet -- ADSL2+ at the cheapest price in Australia: http://www.tandb.com.au/broadband/?ml _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users