Re: [SQL] efficient count/join query

2003-02-07 Thread Tomasz Myrta
Gary Stainburn wrote: On Friday 07 Feb 2003 1:26 pm, Tomasz Myrta wrote: Gary Stainburn wrote: Many appologoes Tomasz. No problem Because your select *LOOKED* wrong to me, I didn't even try it. Upon looking at it again I can see what you're doing. When I tried, it complained about t

Re: [SQL] efficient count/join query

2003-02-07 Thread Gary Stainburn
On Friday 07 Feb 2003 1:26 pm, Tomasz Myrta wrote: > Gary Stainburn wrote: > > On Friday 07 Feb 2003 10:48 am, Tomasz Myrta wrote: > > > > > Hi Tomasz, > > [snip] > > I understood your problem well and I just thought some idea will be enough > to continue work. > > Here is detailed query for your

Re: [SQL] efficient count/join query

2003-02-07 Thread Richard Huxton
On Friday 07 Feb 2003 12:57 pm, Gary Stainburn wrote: > > Thinking about it, I'm not wanting to perform a join as such, but a merge > of the two selects below, then some form of group by to sum() the two > counts. > > select rosid as sid, rojid as jid, count(*) as count > from

Re: [SQL] efficient count/join query

2003-02-07 Thread Tomasz Myrta
Gary Stainburn wrote: On Friday 07 Feb 2003 10:48 am, Tomasz Myrta wrote: Hi Tomasz, I don't think you understand what I mean. The history table could be thought of as the following SQL statement if the data had actually existed. This table actually represents a manually input summary of

Re: [SQL] efficient count/join query

2003-02-07 Thread Gary Stainburn
On Friday 07 Feb 2003 12:09 pm, Gary Stainburn wrote: > On Friday 07 Feb 2003 10:48 am, Tomasz Myrta wrote: > > Gary Stainburn wrote: > > > Hi folks, > > > > > > I've got two tables, first a history table containing tallies for > > > staff/jobs prior to going live, and second a roster table showing

Re: [SQL] efficient count/join query

2003-02-07 Thread Gary Stainburn
On Friday 07 Feb 2003 10:48 am, Tomasz Myrta wrote: > Gary Stainburn wrote: > > Hi folks, > > > > I've got two tables, first a history table containing tallies for > > staff/jobs prior to going live, and second a roster table showing date, > > diagram, job with one record per person per job per day

Re: [SQL] efficient count/join query

2003-02-07 Thread Tomasz Myrta
Gary Stainburn wrote: Hi folks, I've got two tables, first a history table containing tallies for staff/jobs prior to going live, and second a roster table showing date, diagram, job with one record per person per job per day. the tables are: create table history ( hsid int4 not null referenc

[SQL] efficient count/join query

2003-02-07 Thread Gary Stainburn
Hi folks, I've got two tables, first a history table containing tallies for staff/jobs prior to going live, and second a roster table showing date, diagram, job with one record per person per job per day. the tables are: create table history ( hsidint4 not null references staff(sid), hjid