Click to See Complete Forum and Search --> : how to implement user function/query
gbr
July 28th, 2005, 04:31 AM
Hi,
In my database I have a table which is some kind of history log. The report is designed to group these entries by date. Showing the history data for the entries works fine, but for any history entry I need to show its previous entry, too (that means the table row with maximum date being smaller than the current selected). But what function/query do I have to implement?
Help would be highly appreciated.
Thank you,
gbr
Soft_Brains
July 28th, 2005, 05:12 AM
use
Select statement with between, and
gbr
July 28th, 2005, 06:37 AM
But how can I use the result of a select statement in a function? What I wanted to do is getting all dates and getting the latest which is below the current selected (of the group).
gbr
Soft_Brains
July 28th, 2005, 11:45 PM
send me ur code and table structure
gbr
July 29th, 2005, 11:17 AM
+----------------+----------------------+------+-----+---------+---------------------+
| Field | Type | Null | Key | Default | Extra |
+----------------+----------------------+------+-----+---------+---------------------+
| id | int(10) unsigned | | PRI | NULL | auto_increment |
| id_cust | int(10) unsigned | | | 0 | |
| add_data | varchar(20) | YES | | NULL | |
+----------------+---------------------+------+-----+---------+----------------------+
Imagine you have a table with the dates a user bought something. What I want to achive is showing all items groupes by dates and the date before the selected date.
The report shall look like:
date customer goods
old 06/02/05 Mr. Brown ....
now 06/03/05 Mr. Brown ....
--------------------------------------------------------------
old 07/02/05 Mrs. Green ....
new 07/24/05 Mrs. Green ....
Thanks for your replay,
gbr.
gbr
August 1st, 2005, 05:41 AM
It would help if somebody could tell how to write a query (select xyz from tab where ...) and how to store the return value into a variable. Giving an example to familiarize with the crystal syntax would be enough for the beginning.
gbr
gbr
August 2nd, 2005, 11:16 AM
Is there anyone who can tell how to store an entire column of a table in a variable?
When I use this function
local datetimevar array dates := {tab.date};
count(dates);
Only 1 is displayed though there are more than 1 columns in this table...
codeguru.com
Copyright WebMediaBrands Inc., All Rights Reserved.