Re: Using q() to define a query
- From: rvtol+news@xxxxxxxxxxxx (Dr.Ruud)
- Date: Sat, 12 Jan 2008 11:51:42 +0100
Colin Wetherbee schreef:
my $sql = q(SELECT departure_date, eq.name AS equipment,
dp.full_city AS departure_city, ap.full_city AS arrival_city,
ca.name AS carrier_name, number
FROM jsjourneys
FULL OUTER JOIN jscarriers AS ca ON jsjourneys.carrier = ca.id
FULL OUTER JOIN jsequipment AS eq ON jsjourneys.equipment = eq.id
JOIN jsports AS dp ON jsjourneys.departure_port = dp.id
JOIN jsports AS ap ON jsjourneys.arrival_port = ap.id
ORDER BY departure_date);
(As an aside, how do you guys quote your queries? I find that for
anything longer than about 60 characters, q() and '' and everything
else start to look horribly inelegant.)
my $sql = <<'SQL';
SELECT
jo.departure_date AS departure
, eq.name AS equipment
, dp.full_city AS departure_city
, ap.full_city AS arrival_city
, ca.name AS carrier_name
, jo.number
FROM
jsjourneys AS jo
FULL OUTER JOIN
jscarriers AS ca
ON jo.carrier = ca.id
FULL OUTER JOIN
jsequipment AS eq
ON jo.equipment = eq.id
JOIN
jsports AS dp
ON jo.departure_port = dp.id
JOIN
jsports AS ap
ON jo.arrival_port = ap.id
ORDER BY
departure
SQL
(why aren't these "FULL OUTER JOIN"s not just "JOIN"s?)
BTW, some editors recognize certain heredoc-delimiters (like SQL) and
switch language for color coding, autocompletion, etc.
--
Affijn, Ruud
"Gewoon is een tijger."
.
- Follow-Ups:
- Re: Using q() to define a query
- From: Peter J. Holzer
- Re: Using q() to define a query
- From: Colin Wetherbee
- Re: Using q() to define a query
- References:
- Using q() to define a query
- From: Colin Wetherbee
- Using q() to define a query
- Prev by Date: RE: Using q() to define a query
- Next by Date: Re: Using q() to define a query
- Previous by thread: Re: Using q() to define a query
- Next by thread: Re: Using q() to define a query
- Index(es):
Relevant Pages
|