xvszero
09-22-2009, 01:33 PM
Hi, I'm trying to run some code. Basically we identify an account as a unique account by a combination of the class and account fields. Line3 is a unique identifier used per each account for each memo. So essentially, if I want to get a unique memo identifier I need 3 fields, and it might look something like this...
class | account | line3
100 | 100000 | 0 <-- first memo identifier for the 100-100000 account
100 | 100000 | 1 <-- second memo identifier for the 100-100000 account
200 | 100000 | 0 <-- first memo identifier for the 200-100000 account
In other words, it's the combination of the 3 that creates the unique identifier for any given memo.
So I'm pretty close in pulling up the memos correctly. If I just group by one field...
select class, account, group_concat(desc40 order by aline) as groupconcat from blfnotes group by class
It only takes about a minute to finish, and I get the type of data I need. But that isn't quite the correct data because it is ignoring the other two fields needed to create the unique identifier for a memo in the group by. What I really need is this...
select class, account, group_concat(desc40 order by aline) as groupconcat from blfnotes group by class, account, line3
(memos are broken up by line and stored in the desc40 field, with aline as the line # reference)
I am pretty sure that would return what I need, but when I try to run that it just goes on and on and on and never finishes. I let it go for about a half hour earlier and it didn't finish. This is for reports run sort of on the fly, I need something that works in a few minutes tops.
All 3 of those fields are indexed. Not sure what else I can actually do to make this thing run? Or maybe there is an alternative solution I am not thinking of?
class | account | line3
100 | 100000 | 0 <-- first memo identifier for the 100-100000 account
100 | 100000 | 1 <-- second memo identifier for the 100-100000 account
200 | 100000 | 0 <-- first memo identifier for the 200-100000 account
In other words, it's the combination of the 3 that creates the unique identifier for any given memo.
So I'm pretty close in pulling up the memos correctly. If I just group by one field...
select class, account, group_concat(desc40 order by aline) as groupconcat from blfnotes group by class
It only takes about a minute to finish, and I get the type of data I need. But that isn't quite the correct data because it is ignoring the other two fields needed to create the unique identifier for a memo in the group by. What I really need is this...
select class, account, group_concat(desc40 order by aline) as groupconcat from blfnotes group by class, account, line3
(memos are broken up by line and stored in the desc40 field, with aline as the line # reference)
I am pretty sure that would return what I need, but when I try to run that it just goes on and on and on and never finishes. I let it go for about a half hour earlier and it didn't finish. This is for reports run sort of on the fly, I need something that works in a few minutes tops.
All 3 of those fields are indexed. Not sure what else I can actually do to make this thing run? Or maybe there is an alternative solution I am not thinking of?