in reply to Avoiding SQL double jeopardy
When you insert rows, set "PersonRole" to either "Teacher" or "Student", as appropriate. Then you just query for PersonId (and PersonRole, if it's important to know that in the given situation).CREATE TABLE Sessions ( SessId INTEGER -- oops.. cannot be PRIMARY KEY AUTOINCREMENT, PersonId INTEGER, PersonRole TEXT, DoneDate TEXT, Topic TEXT )
Further update: since session-id can't be unique in this approach, you might want another (unique) id field, or two tables: one for sessions, one for participants in sessions.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Avoiding SQL double jeopardy
by NetWallah (Canon) on Jun 27, 2015 at 04:28 UTC | |
by GrandFather (Saint) on Jun 27, 2015 at 05:55 UTC | |
|
Re^2: Avoiding SQL double jeopardy
by GrandFather (Saint) on Jun 27, 2015 at 05:52 UTC | |
by Pope-O-Matik (Pilgrim) on Jun 28, 2015 at 03:55 UTC | |
by GrandFather (Saint) on Jun 28, 2015 at 05:08 UTC | |
by Pope-O-Matik (Pilgrim) on Jun 28, 2015 at 09:25 UTC | |
by GrandFather (Saint) on Jun 28, 2015 at 10:21 UTC | |
| |
|
Re^2: Avoiding SQL double jeopardy
by Pope-O-Matik (Pilgrim) on Jun 28, 2015 at 03:23 UTC |