[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: SQR Date comparison in Database
- Subject: Re: SQR Date comparison in Database
- From: Jill Hughes <jihughes@HOTMAIL.COM>
- Date: Fri, 18 Jan 2002 09:27:12 +0000
Nags,
If you had all the types of items listed in a table, you could loop through
it and make a call to another procedure to get the number for each type.
Something like this:
BEGIN-PROGRAM
BEGIN-SELECT
item &item ! e.g. apple etc
LET $item=&item
DO get_amount($item, #amount)
print $item (+1,13)
print #amount (,26)
FROM all_items
END-SELECT
END-PROGRAM
BEGIN-PROCEDURE get_amount($p_item, :#p_amount)
BEGIN-SELECT
sum(*) &amount
LET #p_amount=&amount
FROM orders
WHERE item=$p_item
END-SELECT
END-PROCEDURE
Hope this helps,
Jill
Subject: SQR Date comparison in Database
Date: Thu, 17 Jan 2002 20:18:53 +0530
Hi,
I have a Question in SQR date comparison with database .In Database , we
have the Values for Dates in UTC ( sec's past Jan,1,1970) Ex: the value of
Oct-01-2001 21:02:33 will be stored as
1002056553.
Question
I want to compare the dates alone , and count the no of Orders leaving
aside the time Portion of UTC .Because in a Day i may have multiple orders
raised in specific time intervals
Oct-01-2001 21:02:33 no of orders-5
Oct-01-2001 22:03:33 no of orders -10
Oct-01-2001 23:03:33 no of orders -20
Oct-01-2001 23:03:34 no of orders -5
I have to find the aggrecate of this Date as display as follows :
Oct-01-2001 40 ( Fruits )
Leaving the time in Display is not a Problem .I have wriiten a function in
Ucall.c , to convert UTC to the Required time Format .
But i wish to do my comparisons with Respect to date and not with respect
to Date and time
Can u suggest me a way please as usual .Again this is in the hit list.We
tried a method and it did work , but i feel it found about.We passed the UTC
to a function in ucall.c which returns the truncated date string.we made the
aggrecate with this .Is this the way out ?
another Question :
To compare i have the list in a table (orange,grape,wine,tablets etc ).The
table which am comparing has the value from one among the list .
Example: a customer drops in and Buys just apples. I have the show a
tabular Report which should have
Nags orange=0 grape=0 apple=5 etc
xxx
and so- on
a 0 for the items not listed in the query has to be displayed .We tried a
round about way and it did work .If the Database had a null value then
there is no problem we can do it , but it has the value which is one among
the list from the table .For the other ones which are'nt in pict , i
should display a report .
Kindly suggest me a way for this too.
Thanks in advance .
Regards
Nags
_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com