[thelist] mySQL queries

rudy r937 at interlog.com
Mon Aug 12 16:13:01 CDT 2002


> The trade-off in my opinion of working with MySQL is that
> you are forced to be more careful and explicit than when
> working with some other database managers

sorry to disagree but it's the other way round

mysql lets you get away with crap that other databases don't

for example, in standard sql, every non-aggregate column in the SELECT list
must be explicitly mentioned in the GROUP BY clause, but in mysql you can
group by whatever you damned well please and devil take the hindmost (i.e.
sometimes you get results different from what you intended)

case in point:  beau's "working" solution

SELECT
billing_job.*,
billing_invoice.*,
SUM(billing_invoice.amount)
...
GROUP BY
billing_job.job_id


you cannot get away with that in a real database

if there are multiple invoices per job, which one provides the individual
column values (billing_invoice.*)?  no individual values from the invoice
table should be available in the job_id groups...


rudy




More information about the thelist mailing list