Re: [SQL] master-detail relationship and count

2002-12-05 Thread Ross J. Reedstrom
On Fri, Nov 29, 2002 at 02:39:50PM +, Gary Stainburn wrote: > I've worked out a way of doing it by vreating a view for the tally info as: > > create view link_tally as > select lklid, lktype, count(*) from links group by lklid, lktype; > > and then doing: > > select r.rtid, r.rtname, l.cou

Re: [SQL] master-detail relationship and count

2002-11-29 Thread Gary Stainburn
I've worked out a way of doing it by vreating a view for the tally info as: create view link_tally as select lklid, lktype, count(*) from links group by lklid, lktype; and then doing: select r.rtid, r.rtname, l.count from route r left outer join link_tally l on r.rtid = l.lklid and l.lktype =

Re: [SQL] master-detail relationship and count

2002-11-29 Thread Dan Langille
On 29 Nov 2002 at 13:16, Achilleus Mantzios wrote: > On Fri, 29 Nov 2002, Gary Stainburn wrote: > > > As you can see from the extract below, your statement has worked for all > > landmarks that have links, but ignores any landmarks with out links. How can > > I adjust this so that all landmarks

Re: [SQL] master-detail relationship and count

2002-11-29 Thread Achilleus Mantzios
On Fri, 29 Nov 2002, Gary Stainburn wrote: > As you can see from the extract below, your statement has worked for all > landmarks that have links, but ignores any landmarks with out links. How can > I adjust this so that all landmarks are listed, but with a zero count where > appropriate? Then,

Re: [SQL] master-detail relationship and count

2002-11-29 Thread Gary Stainburn
As you can see from the extract below, your statement has worked for all landmarks that have links, but ignores any landmarks with out links. How can I adjust this so that all landmarks are listed, but with a zero count where appropriate? select r.rtid, r.rtname, subsel.cnt from route r, (sele

Re: [SQL] master-detail relationship and count

2002-11-29 Thread Richard Huxton
On Friday 29 Nov 2002 10:06 am, Gary Stainburn wrote: > Hi folks. > > I've got a master detail relationship where I have a railway route table > listing landmarks along the route, and a Links table listing URL's > associated with that landmark. Listed below: > > How can I do a query showing the la

Re: [SQL] master-detail relationship and count

2002-11-29 Thread Achilleus Mantzios
On Fri, 29 Nov 2002, Gary Stainburn wrote: > Hi folks. > > I've got a master detail relationship where I have a railway route table > listing landmarks along the route, and a Links table listing URL's > associated with that landmark. Listed below: > > How can I do a query showing the landmark ID,

[SQL] master-detail relationship and count

2002-11-29 Thread Gary Stainburn
Hi folks. I've got a master detail relationship where I have a railway route table listing landmarks along the route, and a Links table listing URL's associated with that landmark. Listed below: How can I do a query showing the landmark ID, the landmark name, and a count of links associated w