Re: [SQL] sub-select, view and sum()

2003-01-06 Thread Gary Stainburn
On Monday 06 January 2003 6:31 pm, Stephan Szabo wrote: > On Mon, 6 Jan 2003, Gary Stainburn wrote: > > create view turn_details as > > select t.*, d.sid as dsid, d.sname as dname, > > f.sid as fsid, f.sname as fname, > > (select sum(r.rmiles) as rmiles from rides r where

Re: [SQL] sub-select, view and sum()

2003-01-06 Thread Stephan Szabo
On Mon, 6 Jan 2003, Gary Stainburn wrote: > create view turn_details as > select t.*, d.sid as dsid, d.sname as dname, > f.sid as fsid, f.sname as fname, > (select sum(r.rmiles) as rmiles from rides r where r.rtid = tid) > as rmiles > from turns t >

[SQL] sub-select, view and sum()

2003-01-06 Thread Gary Stainburn
Hi folks, I've got 3 tables (plus others), and want to create a view joining them. Below are the two main tables and the view I'm trying to create. Anyone, got any idea how I need to word the 'create view' create table turns (-- Turns Table. Hold details of my turns tid