Skip to content

Instantly share code, notes, and snippets.

@ocharles
Created January 25, 2009 05:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ocharles/51702 to your computer and use it in GitHub Desktop.
Save ocharles/51702 to your computer and use it in GitHub Desktop.
# The following executes only 1 SQL statement, and prints the names of all the releases (in my test data example - 2)
# that Massive Attack had artist credit for.
# SELECT me.id, me.name, me.gid, me.modpending, me.quality, me.modpending_qual, me.modpending_lang, me.artist, me.attributes, me.language, me.script,
# name.id, name.page, name.name, name.refcount FROM album me JOIN artist_credit artist ON ( artist.id = me.artist ) LEFT JOIN artist_credit_name
# names ON ( names.artist_credit = artist.id ) JOIN release_name name ON ( name.id = me.name ) WHERE ( names.artist = ? ): '1101'
for ($schema->resultset('Release')->by_artist($massive_attack)) {
diag("\t Release: " . $_->name->name);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment