Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB SQL » View Thread |
Messages 1 to 3 of 3 total |
Ignore depending what is in a second table. |
Sun, Dec 9 2018 9:53 PM | Permanent Link |
Ian Branch | Hi Team,
D10.2.3, EDB 2.28. I have the following Query SQL code which works. {sql} select * from lineitems where (buscode = 'Z') or (Buscode = :BusCode)or (Buscode = 'D') order by JobNo, PartNo {sql An associated table is JobTickets with a common field of JobNo. There may be 1 or more Line Items per JobNo. I need to limit the records viewed in the above query to only those that their relevant Jobticket does not have a jobstatus of 'CA', CO' or 'CL'. Any assistance appreciated. Regards & TIA, Ian |
Mon, Dec 10 2018 2:30 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Ian
I don't have any data in LineItems to test agains but this should do the job select * from lineitems where ((buscode = 'Z') or (Buscode = :BusCode)or (Buscode = 'D')) AND JobNo IN (SELECT JobNo FROM JobTickets WHERE (NOT JobStatus IN ('CA','CO', 'CL')) OR JobStatus IS NULL) order by JobNo, PartNo A JOIN may be faster but I often find they have unexpected consequences (ie I hadn't thought it through properly) in terms of which rows are selected Roy Lambert |
Mon, Dec 10 2018 3:42 AM | Permanent Link |
Ian Branch | Hi Roy,
Thanks for that. Works perfectly. Regards, Ian |
This web page was last updated on Tuesday, September 17, 2024 at 04:19 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |