|
I seem to recall saying that you needed to stop comparing numerics to
characters...
<snip>
Your next problem is that you are comparing a numeric column to a
character column:
</snip>
Looks like you're figuring that out.
Rob Berendt
--
IBM Certified System Administrator - IBM i 6.1
Group Dekko
Dept 1600
Mail to: 7310 Innovation Blvd, Suite 104
Ft. Wayne, IN 46818
Ship to: 7310 Innovation Blvd, Dock 9C
Ft. Wayne, IN 46818
http://www.dekko.com
-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of
jerry ven
Sent: Friday, July 1, 2022 2:08 PM
To: Therrien, Paul <ptherrien@xxxxxxxxxxx>
Cc: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: [EXTERNAL] records between two dates
CAUTION: This email originated from outside of the organization. Do not
click links or open attachments unless you recognize the sender and know
the content is safe.
Hi,
I tried creating SQL query on main file file1 and view V1 on this like
below:-
SQL-if my sql query is like this :- ' SELECT * FROM LIB1/file1 where
((field1* 1000000) + ( field2*10000) + (field3*100) + field4) between
'20210601' and '20210607'
View:- CREATE VIEW LIB1/V1 AS ( SELECT DIGITS(DEC(FIELD1*1000000) +
(FIELD2*10000) + (FIELD3*100) + FIELD4,8,0)) AS MYDATE , A.* FROM
LIB1/FILE1 A)
Then tried below as well after including/removing single quotes from
numbers for below SQL queries ( on file1) and View Queries (V1):-
1. SELECT count(*) FROM LIB1/file1 where
((field1* 1000000) + ( field2*10000) + (field3*100) + field4)
between
'20210601' and '20210607'
2. SELECT count(*) FROM LIB1/file1 where
((field1* 1000000) + ( field2*10000) + (field3*100) +
field4) between
20210601 and 20210607
3. select count(*) from lib1/v1 where MYDATE between '20210601' and
'20210607'
4) select count(*) from lib1/v1 where MYDATE between 20210601 and
20210607
Output :- 1. = 2. for record count.
3. = 4. for record count.
but record count for (1. and 2. SQL Queries ( on file1) was too less than
compared to record count for (3. and 4. (SQL queries for record count for
view (V1) )
So What correction either in SQL query on file1 or in the SQL query on view
V1 need to be done here or is there any correction required in both here ?
Thanks.
On Fri, 1 Jul 2022 at 22:11, Therrien, Paul <ptherrien@xxxxxxxxxxx> wrote:
You are in debug and data analysis mode now.midrange-l@xxxxxxxxxxxxxxxxxx
If your view is not getting the set of data you are expecting then your
view definition needs to be looked at and your data analysis assumptions
need to be looked at.
*From:* jerry ven <jerryven95@xxxxxxxxx>
*Sent:* Friday, July 1, 2022 12:35 PM
*To:* Therrien, Paul <ptherrien@xxxxxxxxxxx>
*Cc:* Midrange Systems Technical Discussion <
count.*Subject:* Re: [EXTERNAL] records between two dates
Hi,
I meant after changing the date to some other date name like 'mydate':-
Select count(*) from V1 where mydate between 20210601 and 20210607’
Became equivalent to WRKQRY's report count.
... But the main file on which this view was based has too low record
count compared to this view count i mean for below main SQL query:-
' SELECT * FROM LIB1/file1 where ((field1* 1000000) + ( field2*10000) +
(field3*100) + field4) between '20210601' and '20210607'
It shows very few records compared to the above View (V1) Query's
--
Thanks.
midrange.com by shopping at amazon.com with our affiliate link:
https://amazon.midrange.com
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.
Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.
Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.