Baanboard.com

Go Back   Baanboard.com > Forum > Baan Quick Support: Functional & Technical > Tools Development

User login

Frontpage Sponsor

Main

Google search


Poll
How big is your Baan-DB (just Data AND Indexes)
0 - 200 GB
15%
200 - 500 GB
30%
500 - 800 GB
4%
800 - 1200 GB
4%
1200 - 1500 GB
11%
1500 - 2000 GB
15%
> 2000 GB
22%
Total votes: 27

Baanboard at LinkedIn


Reference Content

Reply
 
Thread Tools Display Modes
  #1  
Old 2nd June 2018, 11:43
Svidos29 Svidos29 is offline
Member
 
Join Date: Oct 2017
Posts: 47
Svidos29 is on a distinguished road
Baan: Baan IV - DB: Onpen Sql - OS: Windows 10
select last records
Baan: ERP LN 6.1 FP9 (Infor ERP 10.3)
C/S: Client

Hello,

i've a little problem that i don't know how to manage.

The problem is: I'm selecting a table in order DESC, with some conditions, i've to check if the record that i have selected has 0 sum (of a field in another table that i'm selecting in the selectdo). Here, there are some possibilities:
1) if there is another record after this, it means that it can take the values of this (previous) record;
2) if there are no previous records, it has to take the values for the unique current record that is selected;
3) if the sum is not 0, it has to take the values of the current record;

I hope i explained myself

If i can help i would attach the current code that i built, that doesn't work for the condition number 2.

Thanks, in advance
Reply With Quote
  #2  
Old 4th June 2018, 14:27
giggty's Avatar
giggty giggty is offline
Senior Member
 
Join Date: May 2017
Posts: 104
giggty is on a distinguished road
Baan: Infor ERP 10.6 - DB: MSSQL Server 2008 R2 - OS: Windows Server 2012
Please post your code to make your problem (hopefully) less vague
Reply With Quote
  #3  
Old 4th June 2018, 19:17
Svidos29 Svidos29 is offline
Member
 
Join Date: Oct 2017
Posts: 47
Svidos29 is on a distinguished road
Baan: Baan IV - DB: Onpen Sql - OS: Windows 10
hi,

here the code:
Code:
                select	tctax100.*
		from	tctax100					
		where	tctax100.otof = :cisli220.pfbp
		order by tctax100._index4 desc							
		selectdo
			select 	tctax910.nreg, tctax910.bpid
			from	tctax910
			selectdo
				select	sum(tctax910.amnt):tmp.amnt
				from	tctax910
				where	tctax910.nreg = :tctax100.nreg.c   
				and 	tctax910.bpid = :tctax100.otof
				selectdo
                                         return
                                selectempty
                                          break
                                endselect

Last edited by mark_h : 6th June 2018 at 14:39. Reason: Add baan code tags
Reply With Quote
Sponsored Links
  #4  
Old 6th June 2018, 11:03
giggty's Avatar
giggty giggty is offline
Senior Member
 
Join Date: May 2017
Posts: 104
giggty is on a distinguished road
Baan: Infor ERP 10.6 - DB: MSSQL Server 2008 R2 - OS: Windows Server 2012
Sorry, but It is still not clear to me
Let me recap:
1. You want to get a rowset of tctax100. (What for? Are you building a report?)
2. For the first row you want to get this first row.
3. For rows from number 2 to the last one you want the previous one instead (i. e. instead of 2nd you want 1st and for the last one you want the penultimate - so you have 2 identical first rows?)
4. 3 stays valid unless select sum(tctax910.amnt) for the current row is not 0 - then you want the current row.
Is that 100% correct?
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Select distinct records thru query extension?? arajasek Tools Development 5 25th August 2010 08:24
select last records herambphalke Tools Development 7 25th April 2008 07:23
select multioccurence records baan1612 Tools Development 4 21st March 2008 14:10
how does select return records? dnnslbrwn Tools Development 10 2nd August 2005 14:16


All times are GMT +2. The time now is 18:03.


©2001-2018 - Baanboard.com - Baanforums.com