Re: [SQL] return field from different table conditionally

2008-02-13 Thread Bart Degryse
I gave up trying to do this is a single SQL statement and went over to writing a stored procedure. Unfortunately I get stuck here too. This function gets me the data I need from tables accounts_new, account_ranges and salesunits. CREATE OR REPLACE FUNCTION fnc_test ( INOUT p_dataareaid account

[SQL] return field from different table conditionally

2008-02-13 Thread Bart Degryse
I'm having trouble getting the values I want from my tables. Below you find the DDL's for all tables concerned and some data to test with. What I would like to get as a result is: for each billing_exact record the salesunit from account_ranges if there is a match between billing_exact.lineamount