<div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small">Good morning,</div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small">I'm hoping someone who's more skilled with SQL can help me with this query I'm working with.</div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small">My goal is to find copies where:</div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small"><ul><li>They are on a bib record that has parts</li><li>The parts can't be deleted</li><li>The copy does not have a part assigned</li><li>The copy is holdable, and in a shelving location/status that is holdable</li><li>Temporarily I'm also limiting it to bib records with a Dtst of "m" just to work with a smaller subset of records</li></ul><div>I have the query I'm working with attached, but when I add EXPLAIN to it I see that it's scanning indexes multiple times, so I'm getting lots of dupes in my results. (Which is fine, I can dedupe, but still.)</div><div><br></div><div>Is there a better way to write this query, or has anyone already done something similar I can crib from?</div><div><br></div><div>Thank you!<br>Tiffany</div></div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><span><br><div dir="ltr" style="margin-left:0pt" align="left"><table style="border:none;border-collapse:collapse"><colgroup><col width="89"><col width="414"></colgroup><tbody><tr style="height:123pt"><td style="vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden"><p dir="ltr" style="line-height:1.44;margin-top:0pt;margin-bottom:0pt"><span style="font-size:11pt;font-family:Arial;color:rgb(0,0,0);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"><span style="border:none;display:inline-block;overflow:hidden;width:75px;height:75px"><img src="https://lh6.googleusercontent.com/8c2XlzLbIIC6nDoa4yqQ8MzA0npF4WXpUnhhoK_uTqralZtjqVXRwPgmRep3jGYP6q41Sb0ULXqxX-QppYTC8cQyIfBAdqzLBgqvcQwVczkqqiunlj0KIbvy-R3bp-E0mlhF0A4v" width="75" height="75" style="margin-left:0px;margin-top:0px"></span></span></p></td><td style="vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden"><p dir="ltr" style="line-height:1.44;margin-left:9pt;margin-top:0pt;margin-bottom:0pt"><span></span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-family:Verdana,sans-serif;color:rgb(30,67,155);background-color:transparent;font-weight:700;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">Tiffany Little, PINES Bibliographic Projects Manager</span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"></p><hr><p></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:9pt;font-family:Verdana,sans-serif;color:#1e439b;background-color:transparent;font-weight:700;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap">Georgia Public Library Service</span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:9pt;font-family:Verdana,sans-serif;color:#1e439b;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap">2872 Woodcock Blvd, Suite 250 | Atlanta, GA 30341</span></p><p dir="ltr" style="line-height:1.44;margin-left:9pt;margin-top:0pt;margin-bottom:0pt"><span></span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:9pt;font-family:Verdana,sans-serif;color:#1e439b;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap">(404) 235-7161 | <a href="mailto:tlittle@georgialibraries.org" target="_blank">tlittle@georgialibraries.org</a></span></p><br><p dir="ltr" style="line-height:1.44;margin-left:9pt;margin-top:0pt;margin-bottom:0pt"><span style="font-size:11pt;font-family:Arial;color:rgb(0,0,0);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"><span style="border:none;display:inline-block;overflow:hidden;width:36px;height:36px"><img src="https://lh6.googleusercontent.com/ql1so1R8csbb2W7DW5vjWe3mTAcApuM7a5CMXbsYnhmF1bDmG62LM_C1BOOyWdkb2PZGKGlaYRIceHjsSvsWPXNw6HPCKqtFLMKCJiPVU0RXu2dAey13WZ02Q6E6FmzNDJ_d9iBf" width="36" height="36" style="margin-left:0px;margin-top:0px"></span></span><span style="font-size:11pt;font-family:Arial;color:rgb(0,0,0);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"><span style="border:none;display:inline-block;overflow:hidden;width:35px;height:35px"><img src="https://lh3.googleusercontent.com/2qSr0-AREIyPSTC1gMsjyXLaBT-yQ7kS6iKvd1L9XrCXxhJDWCRo5eXBHCi7f35AZASOOyiH2Si-wtuXNR8YaA2j-17GWBmmo1mpGxXa7m-JwF4AzUD_5tZZE9n1NVilAJcnGtQs" width="35" height="35" style="margin-left:0px;margin-top:0px"></span></span><span style="font-size:11pt;font-family:Arial;color:rgb(0,0,0);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"><span style="border:none;display:inline-block;overflow:hidden;width:35px;height:35px"><img src="https://lh6.googleusercontent.com/-jM_GEWd7EZGo5MFiR1koKEkiupb_lmwNEMpNiQE3U6k1C2FkyuiNjtGKlWWGfX8zbZ1135yhOHnJSINmMTXgEQuu2RlHIg5hDKxaJ9cmh3Nr6el_vN4ZHlXcAmoCPPWduwXi26m" width="35" height="35" style="margin-left:0px;margin-top:0px"></span></span></p></td></tr><tr style="height:21pt"><td colspan="2" style="vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden"><p dir="ltr" style="line-height:1.44;text-align:center;margin-top:0pt;margin-bottom:0pt"><a href="http://georgialibraries.org/" target="_blank"><span style="font-size:8pt;font-family:Verdana;color:rgb(17,85,204);background-color:transparent;font-style:italic;vertical-align:baseline;white-space:pre-wrap">Join our email list</span></a><span style="font-size:8pt;font-family:Verdana;color:rgb(0,0,0);background-color:transparent;font-style:italic;vertical-align:baseline;white-space:pre-wrap"> </span><span style="font-size:8pt;font-family:Verdana;color:rgb(67,67,67);background-color:transparent;font-style:italic;vertical-align:baseline;white-space:pre-wrap">for stories of Georgia libraries making an impact in our communities.</span></p></td></tr></tbody></table></div></span></div></div></div></div>