Nurf

Where it's all at!

Solving a VIEWS 2 problem: MAX and GROUP BY custom SQL queries

So, we have an interesting challenge with VIEWS 2 and the needs of the SLSA catalogue.

The problem stems from a very simple requirement: get the ceiling price of a product and display it in a table listing all products for a given taxonomy.

In an ideal world, the following SQL query would be used. A fairly straight forward process in any circumstance other than ours.


SELECT product.model AS model_number, supplier.reference AS supplier_name,
MAX(product_supplier_join.price) AS ceiling
FROM product_table product
JOIN product_supplier_join_table product_supplier_join ON product.model = product_supplier_join.product_model
JOIN supplier_table supplier ON product_supplier_join.supplier_ref
GROUP BY model_number, supplier_name

You'll note the use of MAX() and the GROUP BY features.

Since we have some radically different table and field names, we'll have to map this statement to real world tables and fields. The following demonstrates what the SQL should look like when using our VIEW:


SELECT node.nid AS nid, node.title AS node_title, node.language AS node_language,
uc_products.model AS uc_products_model,

Orbital Debris

  • This* is a rather interesting mess we seem to be in. Seeing how NASA is dealing with it is quite informative or is it? See for yourself.

Does it seem like the answers are skirting the real issue? Is the planet going to blow up? So that last one isn't quite on point, perhaps we should be worried about this though. Not the planet blowing up, rather the debris accumulating. Seems we're now closing ourselves in.

Well, one good thing can come from it: Earth Defense Shield. Take that E.T.s!

Treadmill Kittens

Books to Review

The Omnivore's Dilemma

The Omnivore's Dilemma

Update: I've actually finished this and am suitably impressed by the awareness of food it has provided me.

2012: The Return of Quetzalcoatl

2012: The Return of Quetzalcoatl book cover

"Our civilization is on a path of ever-increasing acceleration, but what are we rushing toward?..."