samedi 3 janvier 2015

Selecting one variant out of different similar results


I have a table that looks as follows:



Book Format Contents
A html ...
A markdown ...
B html ...
C markdown ...


I want to return only 1 version of a book. If a markdown version exists, I want markdown, otherwise I want html.


I'd love to see a SELECT statement that does this, and also a reason why it works.


I think this query is very close to what I need, but I don't understand how it works.


Thanks!





Aucun commentaire:

Enregistrer un commentaire