What is the high lap total for a grid less than 6, and a Time/Retired of halfshaft?
CREATE TABLE "race" (
  "driver" text,
  "constructor" text,
  "laps" real,
  "time_retired" text,
  "grid" real
);
SELECT MAX("laps") FROM "race" WHERE "grid"<6 AND "time_retired"='halfshaft';