Den 19.12.2015 20:38, skrev 'Daniel Miller' dmil...@amfes.com
[firebird-support]:
> With correction for one or two typos - those both worked, thank you!
> Had to read, and read, and read - to try to understand HOW these work.
> Which was exactly what I was hoping for - to better understand usage o
To: firebird-support@yahoogroups.com
Sent: 12/19/2015 2:14:23 AM
Subject: Re: [firebird-support] select parent based on multiple child
conditions
>Here's two alternatives for you, they should give the same result
>(though provide different options for modifications, see the comments
>inside
Here's two alternatives for you, they should give the same result
(though provide different options for modifications, see the comments
inside the SQL), pick the one you prefer. Both differ from your SQL in
that rows are also returned when there are no routes, whereas your SQL
would require at
Took me a bit to feel my way through, but my first attempt appears to
be working:
select distinct n.NODE, count(r.NODE_ID) from NODES n
join ROUTES r on n.ID=r.NODE_ID
where (r.ROUTE_INDEX=1 and (r.QUALITY<7)) or (r.ROUTE_INDEX=2 and
(r.QUALITY<7))
group by n.NODE
union
SELECT n.NODE, COUNT(
I'm not sure how to construct this. There's probably an elegant
solution available - I'm trying to feel my way there but...
Two tables.
CREATE TABLE NODES
(
ID Smallint NOT NULL,
NODE Smallint NOT NULL,
PRIMARY KEY (ID),
UNIQUE (NODE)
);
CREATE TABLE ROUTES
(
ID Integer NOT NULL,