Click here to Skip to main content
15,920,383 members
Home / Discussions / Database
   

Database

 
GeneralRe: Getting the columns Pin
joemonvarghese1-Nov-07 23:32
joemonvarghese1-Nov-07 23:32 
AnswerRe: Getting the columns Pin
r a j u u30-Oct-07 23:12
r a j u u30-Oct-07 23:12 
AnswerRe: Getting the columns Pin
Krish - KP30-Oct-07 23:25
Krish - KP30-Oct-07 23:25 
AnswerRe: Getting the columns Pin
Senu Gandhi31-Oct-07 1:56
Senu Gandhi31-Oct-07 1:56 
Questioncan MySQL Server 5.0 support command " sp_who" and "sp_who2"? Pin
skyleo_200830-Oct-07 21:09
skyleo_200830-Oct-07 21:09 
AnswerRe: can MySQL Server 5.0 support command " sp_who" and "sp_who2"? Pin
N a v a n e e t h30-Oct-07 21:20
N a v a n e e t h30-Oct-07 21:20 
GeneralRe: can MySQL Server 5.0 support command " sp_who" and "sp_who2"? Pin
skyleo_200830-Oct-07 22:20
skyleo_200830-Oct-07 22:20 
QuestionQuery Pin
Giri K30-Oct-07 14:03
Giri K30-Oct-07 14:03 
hey Guys, i am having troubling with this query., i want to Assign the RefinanceAmount instead of LoanAmount if the LoanID exists in tblLoanPurpose(LoanID, RefinanceID, RefinanceAmount) which i joined the table.

the way i want is
L.LoanAmount = 'NewfundsAmt'+@RefinanceAmount

the whole Query is

set ANSI_NULLS OFF
set QUOTED_IDENTIFIER ON
GO

Anyone pls Help..




ALTER PROC [dbo].[upExceptions_GetPending]
@UserID varchar(10)
AS
BEGIN
Declare @LoanAmount money
Declare @RefinanceAmount money

SELECT E.ExceptionID,
I.IntroducerID,
I.TradingName,
E.LoanID,
'' [LoanIncrease], --tooltip
A.ShortName,
LS12.StageDate [SettlementDate],
CRT.CommissionRunType,
CR.CommissionRunDate,
ET.ExceptionType [Reason],
L.LoanAmount [Amount],
ISNULL(L.CurrentBalance, 0) [CurrentBalance],
E.ExceptionRate,
NULL [ExceptionDays],
E.ExceptionAmount,
NULLIF(E.ExceptionGST, 0) [ExceptionGST],
E.ExceptionTotal
FROM tblCommissionRun CR
INNER JOIN tblException E ON E.CommissionRunID = CR.CommissionRunID
INNER JOIN FastLoan_Applications.dbo.tblIntroducer I ON I.IntroducerID = E.IntroducerID
INNER JOIN FastLoan_Applications.dbo.tblLoan L ON L.LoanID = E.LoanID
INNER JOIN FastLoan_Applications.dbo.tblLoanPurpose LP ON LP.LoanID = E.LoanID AND LP.RefinanceReasonID IN (8,9,12)
INNER JOIN FastLoan_Applications.dbo.tblApplication A ON A.ApplicationID = L.ApplicationID
LEFT JOIN FastLoan_Applications.dbo.tblLoanStage LS12 ON LS12.LoanID = L.LoanID
AND LS12.LoanStageTypeID = 6
LEFT JOIN trefCommissionRunType CRT ON CRT.CommissionRunTypeID = CR.CommissionRunTypeID
LEFT JOIN trefExceptionType ET ON ET.ExceptionTypeID = E.ExceptionTypeID
WHERE CR.Pending = 1
AND CR.CommissionRunTypeID IN (1,2)
AND E.LoanIncreaseID IS NULL

UNION ALL

--UPFRONT LOAN INCREASES
SELECT E.ExceptionID,
I.IntroducerID,
I.TradingName,
E.LoanID,
'Loan Increase' [LoanIncrease], --tooltip
A.ShortName,
LIS12.StageDate [SettlementDate],
CRT.CommissionRunType,
CR.CommissionRunDate,
ET.ExceptionType [Reason],
LI.IncreaseAmount [Amount],
ISNULL(L.CurrentBalance, 0) [CurrentBalance],
E.ExceptionRate,
NULL [ExceptionDays],
E.ExceptionAmount,
NULLIF(E.ExceptionGST, 0) [ExceptionGST],
E.ExceptionTotal
FROM tblCommissionRun CR
INNER JOIN tblException E ON E.CommissionRunID = CR.CommissionRunID
INNER JOIN FastLoan_Applications.dbo.tblIntroducer I ON I.IntroducerID = E.IntroducerID
INNER JOIN FastLoan_Applications.dbo.tblLoan L ON L.LoanID = E.LoanID
INNER JOIN FastLoan_Applications.dbo.tblLoanIncrease LI ON LI.LoanID = E.LoanID
INNER JOIN FastLoan_Applications.dbo.tblApplication A ON A.ApplicationID = L.ApplicationID
LEFT JOIN FastLoan_Applications.dbo.tblLoanIncreaseStage LIS12 ON LIS12.LoanIncreaseID = LI.LoanIncreaseID
AND LIS12.LoanStageTypeID = 6
LEFT JOIN trefCommissionRunType CRT ON CRT.CommissionRunTypeID = CR.CommissionRunTypeID
LEFT JOIN trefExceptionType ET ON ET.ExceptionTypeID = E.ExceptionTypeID
WHERE CR.Pending = 1
AND CR.CommissionRunTypeID IN (1,2)
AND E.LoanIncreaseID IS NOT NULL


UNION ALL

--TRAIL LOANS
SELECT DISTINCT E.ExceptionID,
I.IntroducerID,
I.TradingName,
E.LoanID,
'' [LoanIncrease], --tooltip
A.ShortName,
LS12.StageDate [SettlementDate],
CRT.CommissionRunType,
CR.CommissionRunDate,
ET.ExceptionType [Reason],
L.LoanAmount [Amount],
ISNULL(L.CurrentBalance, 0) [CurrentBalance],
E.ExceptionRate,
E.ExceptionDays,
E.ExceptionAmount,
NULLIF(E.ExceptionGST, 0) [ExceptionGST],
E.ExceptionTotal
FROM tblCommissionRun CR
INNER JOIN tblException E ON E.CommissionRunID = CR.CommissionRunID
INNER JOIN FastLoan_Applications.dbo.tblIntroducer I ON I.IntroducerID = E.IntroducerID
INNER JOIN FastLoan_Applications.dbo.tblLoan L ON L.LoanID = E.LoanID
INNER JOIN FastLoan_Applications.dbo.tblLoanPurpose LP ON LP.LoanID = E.LoanID AND LP.RefinanceReasonID IN (8,9,12)
INNER JOIN FastLoan_Applications.dbo.tblApplication A ON A.ApplicationID = L.ApplicationID
LEFT JOIN FastLoan_Applications.dbo.trelCustomerApplication CA ON CA.ApplicationID = L.ApplicationID
LEFT JOIN FastLoan_Applications.dbo.tblCustomer C ON C.CustomerID = CA.CustomerID
LEFT JOIN FastLoan_Applications.dbo.tblLoanStage LS12 ON LS12.LoanID = L.LoanID
AND LS12.LoanStageTypeID = 6
LEFT JOIN trefCommissionRunType CRT ON CRT.CommissionRunTypeID = CR.CommissionRunTypeID
LEFT JOIN trefExceptionType ET ON ET.ExceptionTypeID = E.ExceptionTypeID
WHERE CR.Pending = 1
AND CR.CommissionRunTypeID = 3
AND E.LoanIncreaseID IS NULL
AND CA.ApplicantTypeID = 1

UNION ALL

--TRAIL LOAN INCREASES
SELECT DISTINCT E.ExceptionID,
I.IntroducerID,
I.TradingName,
E.LoanID,
'Loan Increase' [LoanIncrease], --tooltip
A.ShortName,
LIS12.StageDate [SettlementDate],
CRT.CommissionRunType,
CR.CommissionRunDate,
ET.ExceptionType [Reason],
LI.IncreaseAmount [Amount],
ISNULL(L.CurrentBalance, 0) [CurrentBalance],
E.ExceptionRate,
E.ExceptionDays,
E.ExceptionAmount,
NULLIF(E.ExceptionGST, 0) [ExceptionGST],
E.ExceptionTotal
FROM tblCommissionRun CR
INNER JOIN tblException E ON E.CommissionRunID = CR.CommissionRunID
INNER JOIN FastLoan_Applications.dbo.tblIntroducer I ON I.IntroducerID = E.IntroducerID
INNER JOIN FastLoan_Applications.dbo.tblLoan L ON L.LoanID = E.LoanID
INNER JOIN FastLoan_Applications.dbo.tblApplication A ON A.ApplicationID = L.ApplicationID
LEFT JOIN FastLoan_Applications.dbo.trelCustomerApplication CA ON CA.ApplicationID = L.ApplicationID
LEFT JOIN FastLoan_Applications.dbo.tblCustomer C ON C.CustomerID = CA.CustomerID
INNER JOIN FastLoan_Applications.dbo.tblLoanIncrease LI ON LI.LoanID = E.LoanID
LEFT JOIN FastLoan_Applications.dbo.tblLoanIncreaseStage LIS12 ON LIS12.LoanIncreaseID = LI.LoanIncreaseID
AND LIS12.LoanStageTypeID = 6
LEFT JOIN trefCommissionRunType CRT ON CRT.CommissionRunTypeID = CR.CommissionRunTypeID
LEFT JOIN trefExceptionType ET ON ET.ExceptionTypeID = E.ExceptionTypeID
WHERE CR.Pending = 1
AND CR.CommissionRunTypeID = 3
AND E.LoanIncreaseID IS NOT NULL
AND CA.ApplicantTypeID = 1

ORDER BY TradingName, SettlementDate
--CRT.CommissionRunType, CR.CommissionRunDate, SettlementDate
END




AnswerRe: Query Pin
Marek Grzenkowicz30-Oct-07 23:40
Marek Grzenkowicz30-Oct-07 23:40 
GeneralRe: Query Pin
Giri K31-Oct-07 14:41
Giri K31-Oct-07 14:41 
GeneralRe: Query Pin
Marek Grzenkowicz4-Nov-07 22:25
Marek Grzenkowicz4-Nov-07 22:25 
GeneralRe: Query Pin
Giri K5-Nov-07 17:53
Giri K5-Nov-07 17:53 
GeneralRe: Query Pin
Giri K31-Oct-07 14:51
Giri K31-Oct-07 14:51 
QuestionSQL Server Express Autoinc Pin
AAGTHosting30-Oct-07 12:18
AAGTHosting30-Oct-07 12:18 
AnswerRe: SQL Server Express Autoinc Pin
pmarfleet30-Oct-07 13:01
pmarfleet30-Oct-07 13:01 
QuestionSqlClient will not connect to 2005 SqlServer Pin
ianhoc30-Oct-07 10:46
ianhoc30-Oct-07 10:46 
AnswerRe: SqlClient will not connect to 2005 SqlServer Pin
Paul Conrad31-Oct-07 14:13
professionalPaul Conrad31-Oct-07 14:13 
GeneralPlease Vote For Persian Collation in SQL Server 2008 Pin
DotNetWWW30-Oct-07 8:05
DotNetWWW30-Oct-07 8:05 
GeneralRe: Please Vote For Persian Collation in SQL Server 2008 Pin
Paul Conrad31-Oct-07 14:14
professionalPaul Conrad31-Oct-07 14:14 
QuestionBasic question on SQL [modified] Pin
niaher30-Oct-07 4:35
niaher30-Oct-07 4:35 
AnswerRe: Basic question on SQL Pin
andyharman30-Oct-07 7:04
professionalandyharman30-Oct-07 7:04 
GeneralRe: Basic question on SQL Pin
niaher30-Oct-07 7:49
niaher30-Oct-07 7:49 
GeneralRe: Basic question on SQL Pin
andyharman30-Oct-07 9:50
professionalandyharman30-Oct-07 9:50 
GeneralRe: Basic question on SQL Pin
niaher30-Oct-07 19:41
niaher30-Oct-07 19:41 
GeneralRe: Basic question on SQL Pin
andyharman31-Oct-07 3:20
professionalandyharman31-Oct-07 3:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.