title: Converting Text Time to Numbers
body: <p>I am attempting to convert two time values, recorded as TEXT, to numerical values for use in a calculation to work out there difference, this is to be implemented within a View.</p>
  
  <p>My current attempt is as follows.</p>
  
  <pre><code>CREATE VIEW TimeTakenSwimming AS 
  SELECT UserDetails.username AS username, 
         SwimmingRecords.distance_in_miles AS distance, 
         SwimmingRecords.start_time AS starttime, 
         SwimmingRecords.end_time AS endtime, 
         sum((strftime('%s', end_time) - strftime('%s', start_time)) AS timedifference,
  FROM UserDetails INNER JOIN SwimmingRecords ON UserDetails.username = SwimmingRecords.username;
  </code></pre>
  
  <p>Now from this I am currently recieving an error relating to the "AS" Syntax. I have been through and corrected any spaces missing, added the missing brackets from the SUM calculation etc, however upon implementation i still recieve the as stated Syntax Error.</p>
  
  <p>Located below is the code relating to my Schema to allow others to attempt to replicate the issue, I have utilised the SQLite manager Firefox Plugin for the implementation of this system.</p>
  
  <pre><code>CREATE TABLE "UserDetails" (
      "username" TEXT PRIMARY KEY  NOT NULL  UNIQUE  CHECK (length(username)&gt;0), 
      "password" TEXT NOT NULL  CHECK (length(password)&gt;3), 
      "email_address" TEXT NOT NULL  UNIQUE CHECK (length(email_address)&gt;3) , 
      "weight_in_pounds" REAL NOT NULL CHECK(weight_in_pounds&gt;0) CHECK (length(weight_in_pounds)&gt;0), 
      "height_in_inches" REAL NOT NULL CHECK(height_in_inches&gt;0) CHECK (length(height_in_inches)&gt;0), 
      "age" INTEGER CHECK(age&gt;0), WITHOUT ROWID
      )
  
  CREATE TABLE "SwimmingRecords" (
      "record_ID" INTEGER PRIMARY KEY  AUTOINCREMENT  NOT NULL  UNIQUE CHECK (record_ID&gt;0) , 
      "distance_in_miles" REAL NOT NULL CHECK (distance_in_miles&gt;0) , 
      "num_of_lengths" REAL NOT NULL CHECK(num_of_lengths&gt;0), "username" TEXT NOT NULL , 
      "date" DATETIME DEFAULT CURRENT_DATE, "notes" TEXT(50), 
      "start_time" TEXT, 
      "end_time" TEXT, 
      FOREIGN KEY(distance_in_miles) REFERENCES DistanceinMiles(distance_in_miles) ON DELETE CASCADE ON UPDATE CASCADE, 
      FOREIGN KEY(num_of_lengths) REFERENCES NumberOfLengths(num_of_lengths) ON DELETE CASCADE ON UPDATE CASCADE,
      FOREIGN KEY(username) REFERENCES UserDetails(username)ON DELETE CASCADE ON UPDATE CASCADE
      )
  </code></pre>
  
  <p>I thank you in advance for any assistance.</p>