/build/static/layout/Breadcrumb_cap_w.png

Best Practices Question


SQL smart label doesn't apply to any machine

06/06/2017 1330 views
I have a smart label to find machines (DELL) which were bought on 2014. I created a report with the same sql code and it works fine, the problem is on smart labels, it doesn't apply to any machine. What i'm doing wrong?

The sql is:

SELECT M.NAME, D.SHIP_DATE FROM MACHINE M JOIN DELL_ASSET D ON D.SERVICE_TAG = M.BIOS_SERIAL_NUMBER WHERE ((M.NAME like 'LAB%') AND (D.SHIP_DATE like '%2014%'))



Answer Summary:
Two things to do: 1st- Must include "MACHINE.ID as TOPIC_ID" on the select clause. 2nd- Must _NOT_ use table abreviations. So, the final SQL is: SELECT MACHINE.NAME, MACHINE.ID as TOPIC_ID FROM MACHINE JOIN DELL_ASSET ON DELL_ASSET.SERVICE_TAG = MACHINE.BIOS_SERIAL_NUMBER WHERE ((MACHINE.NAME like 'LAB%') AND (DELL_ASSET.SHIP_DATE like '%2014%'))
0 Comments   [ + ] Show comments

Comments


Answer Chosen by the Author

0
Most of my smart labels include MACHINE.ID as TOPIC_ID in the select clause, that might be a requirement for them to work, but I'm not positive.
Answered 06/07/2017 by: chucksteel
Red Belt

  • Worked! Also chaged the abreviation for the tables for it to work. Thanks!
    • Could you share how the final SQL looks like?
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ