Is this a valid query? SELECT * FROM customer WHE...
# suiteql
j
Is this a valid query? SELECT * FROM customer WHERE TO_CHAR(TO_DATE(datecreated, 'MM/dd/yyyy'),'yyyyMM') = 201811 we're having issues querying this from another platform that's authenticated to NetSuite...
a
hmm not sure if this is valid, seems a little odd to me... if I wanted a date range of results I'd do where datecreated >= '20181101' AND datecreated < '20181201'
👍 1
the reason i think its not valid is I don't think the datecreated is in a 'MM/dd/yyyy' format to start with
cos its not a date field, its a timestamp field
so not sure if that TO_CHAR works
j
I agree - somehow our consultants seem to think this works even though we're getting errors
Thay want to get everything for the month of Nov 2018
a
that might also be SUPER inefficient.... it would potentially have to TO_CHAR every row to see if it fits the WHERE clause
idk if the query analyzer automatically fixes that for you and does something more sane
j
apparently your method has already been attempted and they not seeing a full list of records... found difference in row counts.
not sure what that means yet
a
???
s
You can use date literals which are more efficient, e.g.
Copy code
SELECT trandate
FROM transaction
WHERE trandate BETWEEN DATE '2023-01-01' AND DATE '2023-12-31'