Ticket Hash: | 7e3fa93744b9e2949a09a80ccbe463725b2aa8e8 | ||
Title: | Problem with 3 table query! | ||
Status: | Closed | Type: | Code_Defect |
Severity: | Severe | Priority: | Immediate |
Subsystem: | Data_Reader | Resolution: | Fixed |
Last Modified: | 2011-11-13 06:25:30 | ||
Version Found In: | 1.0.66.0 and 1.0.76.0 |
Description: | ||||
Table "GunsAndAmmo"
p GunID integer prim autoinvrement GunManufactor text, GunModel text, Division text, Factor text, Table "Shooters" ShooterInternalID integer prim autoincrement, DataBirth integer, LastName text, FirstName text, Table "ShooterGun" ShooterID integer prim not null, GunID integer prim not null, The main quary im havin problems with are: "Select Shooters.FirstName, Shooters.LastName, ShooterGun.ShooterID, GunsAndAmmo.Division, GunsAndAmmo.Factor, GunsAndAmmo.GunManufactor, GunsAndAmmo.GunModel from Shooters, ShooterGun, GunsAndAmmo" This shoudl return about 24 results currently but are only returning 3. If I remove "ShooterGun.ShooterID" from the query then i get the correct number of results but no. The same happens if I use "Shooters.ShooterInternalID" insted of "ShooterGun.ShooterID". This is not a problem when using a different client tool. anonymous added on 2011-10-26 10:33:53 UTC: anonymous added on 2011-10-26 12:35:07 UTC: anonymous added on 2011-10-26 12:46:02 UTC: Table "Shooters" Table "ShooterGun" anonymous added on 2011-10-26 12:47:12 UTC: mistachkin added on 2011-10-26 14:02:31 UTC: Have you tried using the latest System.Data.SQLite? Version 1.0.66.0 was released in April 2010 and quite a few things have been changed and/or fixed since then. Also, is the following SQL what you are doing? CREATE TABLE GunsAndAmmo ( GunID INTEGER PRIMARY KEY AUTOINCREMENT, GunManufactor TEXT, GunModel TEXT, Division TEXT, Factor TEXT ); CREATE TABLE Shooters ( ShooterInternalID INTEGER PRIMARY KEY AUTOINCREMENT, DataBirth INTEGER, LastName TEXT, FirstName TEXT ); CREATE TABLE ShooterGun ( ShooterID INTEGER NOT NULL, GunID INTEGER NOT NULL ); SELECT Shooters.FirstName, Shooters.LastName, ShooterGun.ShooterID, GunsAndAmmo.Division, GunsAndAmmo.Factor, GunsAndAmmo.GunManufactor, GunsAndAmmo.GunModel FROM Shooters, ShooterGun, GunsAndAmmo; INSERT INTO GunsAndAmmo (GunID, GunManufactor, GunModel, Division, Factor) VALUES(2, 'CZ', 'SP-01', 'Shaddow', 'Open'); INSERT INTO GunsAndAmmo (GunID, GunManufactor, GunModel, Division, Factor) VALUES(3, 'CZ', 75, NULL, 'Production'); INSERT INTO Shooters (ShooterInternalID, DataBirth, LastName, FirstName) VALUES(1, 19800506, 'Aanonsen', 'Eirik'); INSERT INTO Shooters (ShooterInternalID, DataBirth, LastName, FirstName) VALUES(2, NULL, 'Westol', 'Stein'); INSERT INTO Shooters (ShooterInternalID, DataBirth, LastName, FirstName) VALUES(3, NULL, 'Eiriksa', 'Aasuhds'); INSERT INTO ShooterGun (ShooterID, GunID) VALUES(1, 3); INSERT INTO ShooterGun (ShooterID, GunID) VALUES(1, 2); INSERT INTO ShooterGun (ShooterID, GunID) VALUES(2, 2); INSERT INTO ShooterGun (ShooterID, GunID) VALUES(2, 3); mistachkin added on 2011-10-26 14:37:49 UTC: anonymous added on 2011-10-28 08:56:56 UTC: CREATE TABLE Shooters ( ShooterInternalID INTEGER PRIMARY KEY AUTOINCREMENT, DataBirth INTEGER, LastName TEXT, FirstName TEXT ); CREATE TABLE ShooterGun ( ShooterID INTEGER NOT NULL, GunID INTEGER NOT NULL, PRIMARY KEY (ShooterID, GunID )); INSERT INTO GunsAndAmmo (GunID, GunManufactor, GunModel, Division, Factor) VALUES(2, 'CZ', 'SP-01', 'Shaddow', 'Open'); INSERT INTO Shooters (ShooterInternalID, DataBirth, LastName, FirstName) VALUES(1, 19800506, 'Aanonsen', 'Eirik'); INSERT INTO ShooterGun (ShooterID, GunID) VALUES(1, 3); SELECT Shooters.FirstName, Shooters.LastName, ShooterGun.ShooterID, GunsAndAmmo.Division, GunsAndAmmo.Factor, GunsAndAmmo.GunManufactor, GunsAndAmmo.GunModel With this the problem exist. Gets only 2 results back. Also under 1.0.76.0 version. The differance is the ShooterGun table where I defined the two collums as primary keys. Thank you for looking on this problem and please point out if I am wrong about something. anonymous added on 2011-10-28 09:34:47 UTC: mistachkin added on 2011-10-28 14:33:49 UTC: mistachkin added on 2011-11-12 06:47:27 UTC: mistachkin added on 2011-11-13 06:00:47 UTC: mistachkin added on 2011-11-13 06:25:30 UTC: |