nooneclose Posted November 21, 2019 Posted November 21, 2019 (edited) Good morning, I am trying to figure out if it is possible to check if these invoice lines exist or not. Here are the table and column name: INVOICELINE.INVOICELINENUM (a required field if created) Here is a picture of what I am talking about. (Do not worry about security. the picture is from a demo test site so all information is fake) is there any way to check if these fields exist or not? (they do not exist unless the user clicks on "New Row") Example: line 11 does not exist right now. How would I go about to see if it did or not? This is what I have so far: SELECT DISTINCT iv.invoicenum, iv.description FROM invoice AS iv JOIN invoiceline AS ivl ON iv.invoicenum = ivl.invoicenum AND iv.siteid = ivl.siteid /* = 'nothing' and yet somehow not null? */ WHERE iv.invoicenum NOT IN (SELECT invoicelinenum FROM invoiceline WHERE invoicelinenum IS NOT NULL) I get 0 results where I should get more than 0. Edited November 27, 2019 by nooneclose Solved
jchd Posted November 21, 2019 Posted November 21, 2019 6 minutes ago, nooneclose said: WHERE iv.invoicenum NOT IN (SELECT invoicelinenum FROM invoiceline WHERE invoicelinenum IS NOT NULL) You're comparing invoicenum and invoicelinenum that is oranges and shoes. FrancescoDiMuro 1 This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
nooneclose Posted November 21, 2019 Author Posted November 21, 2019 @jchd my bad that is a typo it should say (SELECT invoicenum FROM invoiceline WHERE invoicelinenum IS NOT NULL)
nooneclose Posted November 27, 2019 Author Posted November 27, 2019 (edited) Solved it. The only problem is that they "don't exist" without a line number. (nonpersistent) The code does work its just a database issue at this point. Like always here is the final code: SELECT distinct invoicenum, description FROM invoiceline GROUP BY invoicenum, description HAVING SUM(invoicelinenum) < 1 ORDER BY invoicenum Edited January 3, 2020 by nooneclose More Accurate information
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now