android - sqlite 3 sum with inner join returns twice the value it should -
I'm running a question that looks like this I am getting production, 2 rabbits and 6 rabbits, although I have only entered a rabbit and 3 rabbits in the database, I do not know That is why I am returning the amount I want, any advice or improvement in my understanding will be very much received. For completeness I am doing two tables by joining me but making statements Gives and
select SUM (KILLCOUNT), TRIP_DATA.SPECIES = SPECIES.SPECIESIDNO on species TRIP_DATA.TRIPID = 413 group on species by .SPECIES TRIP_DATA.SPECIES from species TRIP_DATA. For this trip (413)
"Table B Relationships are not present "+ TRIP_DATA +" (ID Integer Primary Key Etoincreate, Tripid Incinerator Faucet, GMTTMTAMAP Engineer is not faucet, Letitude is not real, "+" Longioed is not real, aliate real, true accuracy, speed real, spici Integer, Clint Igniger);
does not exist in the table "+ species +" (species text not NULL, ISHUNTED integer not NULL default (1), SPECIESIDNO FILL No NULL, Expensive Lesson); "
After
After some time and research this answer Select that i was looking for
select DISTINCT SPECIES.SPECIES, JOIN from the S.COUNT species (select the totals (KILLCOUNT) count, from TRIP_DATA.SPECIES TRIP_DATA Whereas SPIPCI.SPECIESIDNO = S.SPECIES on TRIPID = "+ tripid +" and NOT TRIP_DATA.SPECIES = 0 group TRIP_DATA.SPECIES)
I understand this as (please note Keep that this is on the limit of my understanding when you Functions done to join an internal tax total work on both primary keys of pairs added tables.
This means that my original approach was never going to work, however, if using the group, make an internal statement and already use the word to add data to the grouped table So it works
Many thanks for the comments, I hope
Comments
Post a Comment