The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

dconger (6) [Avatar] Offline
#1
Listing 1.6 under section 1.4.4 (page 26 of the PDF) includes a join on "r.franchise = f.franchise_code" and makes two references to f.franchise_name. However, the lu_franchise table is set up in listing 1.2 to use the column names "id" and "franchise." (And as I saw mentioned here on the forum already, ch01.roads should be ch01.highways.)

So the correct query appears to be:

SELECT f.franchise
, COUNT(DISTINCT r.id) As total
FROM ch01.restaurants As r
INNER JOIN ch01.lu_franchises As f ON r.franchise = f.id
INNER JOIN ch01.highways As h ON ST_DWithin(r.geom, h.geom, 1609)
GROUP BY f.franchise
ORDER BY total DESC;
regina.leo (265) [Avatar] Offline
#2
Re: Error in list 1.6 franchise_code does not exist
Ah yes. One of us did not like the names and decided to rename everything after the queries were created. We want talk about who that is.
regina.leo (265) [Avatar] Offline
#3
Re: Error in list 1.6 franchise_code does not exist
Fixed.

Thanks