I have a combobox on a datagridview. I am able to populate the values of the combobox, but what I am failing to do is to populate the data base value into the combobox "text" when the datagridview is loading.
I hope this makes sense. Basically I just want the data returned to reflect in the combobox Display.
Your assistance will be highly appreciated.
Dim cbo As DataGridViewComboBoxColumn
If GlobalVariables.UsrSite = 0 Then
SQL.ReadQuery("Select LogsReason as [Logs Update], IncNo as [Number], SiteName As [Site Name], FleetNo As [Fleet No], FleetType As [Fleet Type], Location,
SMR as [Hours], TimeDown As [Down Time], EstTimeUp as [Est Repair], DateDiff(d, TimeDown, GetDate()) as [Days Down]
from UDOData where status = 'Down' order by [Days Down] Desc")
Else
SQL.ReadQuery("Select LogsReason as [Logs Update], IncNo as [Number], SiteName As [Site Name], FleetNo As [Fleet No], FleetType As [Fleet Type], Location,
SMR as [Hours], TimeDown As [Down Time], EstTimeUp as [Est Repair], DateDiff(d, TimeDown, GetDate()) as [Days Down] from UDOData
Where SiteID = " & GlobalVariables.UsrSite & " and Status = 'Down' order by [Days Down] Desc")
End If
dgvUDO.DataSource = SQL.SQLDS.Tables(0)
cbo.DataSource = SQL.SQLDS.Tables(0)
cbo.DisplayMember = "Logs Update"
cbo.ValueMember = "Logs Update"
cbo.DataPropertyName = "Logs Update"
I get exception error saying "logs Update" does not exist, but it loads in the datagridview.
I ended up doing this, which worked for me.
Dim cbo As DataGridViewComboBoxColumn
cbo = dgvUDO.Columns("cboLogsUDO")
Dim AltDb As New DataTable
SQL.ReadQuery("Select Descrip from dbo.UDOLogs")
AltDb = SQL.SQLDS.Tables(0)
'LOAD DATA GRID VIEW DATA
If GlobalVariables.UsrSite = 0 Then
SQL.ReadQuery("Select ID, LogsReason as [Logs Update], IncNo as [Number], SiteName As [Site Name], FleetNo As [Fleet No], FleetType As [Fleet Type], Location,
SMR as [Hours], TimeDown As [Down Time], EstTimeUp as [Est Repair], DateDiff(d, TimeDown, GetDate()) as [Days Down]
from UDOData where status = 'Down' order by [Days Down] Desc")
Else
SQL.ReadQuery("Select ID, LogsReason as [Logs Update], IncNo as [Number], SiteName As [Site Name], FleetNo As [Fleet No], FleetType As [Fleet Type], Location,
SMR as [Hours], TimeDown As [Down Time], EstTimeUp as [Est Repair], DateDiff(d, TimeDown, GetDate()) as [Days Down] from UDOData
Where SiteID = " & GlobalVariables.UsrSite & " and Status = 'Down' order by [Days Down] Desc")
End If
'SET DATA GRIDVIEW DATA SOURCE
dt = SQL.SQLDS.Tables(0)
dgvUDO.DataSource = dt
dgvUDO.Rows(0).Selected = True
'LOAD UPDATE COMMAND FOR DATA GRIDVIEW CHANGES
SQL.SQLDA.UpdateCommand = New SqlClient.SqlCommandBuilder(SQL.SQLDA).GetUpdateCommand
'HIDE UNWANTED COLUMNS
dgvUDO.Columns("Logs Update").Visible = False
dgvUDO.Columns("ID").Visible = False
'SET COMBOBOX ATTRIBUTES
cbo.DataSource = AltDb
cbo.DisplayMember = "Descrip"
cbo.ValueMember = "Descrip"
cbo.DataPropertyName = "Logs Update"
This gives me the ability to call the value in the returned db for the datagridview as the combobox "text" value, but show the drop down items as the items in another table.
Related
SELECT [doc type], [Open Amount],
[customer number],
COUNT([customer number]) As CountCustomerNumber,
SUM(IIF([Open Amount]>'0', [Open Amount], 0)) AS sum_open_amount_pos,
SUM(IIF([Open Amount]<'0', [Open Amount], 0)) As sum_open_amount_neg
FROM
(
SELECT d.[customer number] & d.[membership number] AS CustMemb,
d.[customer number],
agg.[Open Amount],
agg.[doc type],
SUM(agg.[TotalSubOpenAmount]) AS SumOpenAmount
FROM
(
SELECT [doc type],
[customer number],
SUM([Open Amount]) AS TotalSubOpenAmount
FROM data
WHERE [doc type] = 'RU'
GROUP BY [doc type], [customer number], [Open Amount]
) agg
INNER JOIN [data] d
ON d.[customer number] = agg.[customer number]
GROUP BY d.[customer number] & d.[membership number],
d.[customer number],
agg.[doc type],
agg.[Open Amount]
) AS sub
GROUP BY [doc type], [customer number]
HAVING COUNT([customer number]) = 1
I am getting a Parameter Input on MS Access - Open Amount.
How do I reference the open amount in the from query?
Error
'The multi-part identifier "ar_update.Id" could not be bound.'
as line denoted in sql script.
I also tried other columns for the errant join to try to prompt different errors and gives same error results.
Why/How to qualify the 'inner' processing set back to the 'update' set?
update ar_update
set ar_update.[GLEntry_Amount] = ar_sum.[GLEntry_Amount_sum]
from [dbo].[ASL_Result_VGO] as ar_update
join (select ar.[Id] as [Id]
,ar.[Company Id] as [Company Id]
,ar.[Schedule Name] as [Schedule Name]
,ar.[Line No_] as [Line No_]
,ar.[Row No_] as [Row No_]
,ar.[Posting Date] as [Posting Date]
,ar.[Business Centre Code] as [Business Centre Code]
,ar.[Site Locations Code] as [Site Locations Code]
,GLEntry_Amount_sum =
(select sum(are.[GLEntry_Amount])
from [dbo].[ASL_Result_VGO] as are
where are.[Company Id] = ar.[Company Id] and
are.[Schedule Name] = ar.[Schedule Name] and
are.[Posting Date] = ar.[Posting Date] and
are.[Business Centre Code] = ar.[Business Centre Code] and
are.[Site Locations Code] = ar.[Site Locations Code] and
are.[Row No_] in ( select * from dbo.udf_range_expand_VGO(ar.[Totaling]) )
)
from [dbo].[ASL_Result_VGO] as ar
where ar.[Id] = ar_update.[Id] -- The multi-part identifier "ar_update.Id" could not be bound.
) ar_sum on ar_update.[Id] = ar_sum.[Id]
where ar_update.[Totaling Type] = 2 and -- formulas
len(trim(ar_update.[Totaling])) > 0 and
charindex('..', ar_update.[Totaling]) > 0 -- P ranges
this happened because on where ar.[Id] = ar_update.[Id] because ar_update.[Id] is not a value it is a multivalued type, it's like you were comparing a list with an integer, try this
update ar_update
set ar_update.[GLEntry_Amount] = ar_sum.[GLEntry_Amount_sum]
from [dbo].[ASL_Result_VGO] as ar_update
join (select ar.[Id] as [Id]
,ar.[Company Id] as [Company Id]
,ar.[Schedule Name] as [Schedule Name]
,ar.[Line No_] as [Line No_]
,ar.[Row No_] as [Row No_]
,ar.[Posting Date] as [Posting Date]
,ar.[Business Centre Code] as [Business Centre Code]
,ar.[Site Locations Code] as [Site Locations Code]
,GLEntry_Amount_sum = (select sum(are.[GLEntry_Amount])
from [dbo].[ASL_Result_VGO] as are
where are.[Company Id] = ar.[Company Id] and
are.[Schedule Name] = ar.[Schedule Name] and
are.[Posting Date] = ar.[Posting Date] and
are.[Business Centre Code] = ar.[Business Centre Code] and
are.[Site Locations Code] = ar.[Site Locations Code] and
are.[Row No_] in ( select * from dbo.udf_range_expand_VGO(ar.[Totaling]) )
)
from [dbo].[ASL_Result_VGO] as ar
) ar_sum on ar_update.[Id] = ar_sum.[Id]
where ar_update.[Totaling Type] = 2 and -- formulas
len(trim(ar_update.[Totaling])) > 0 and
charindex('..', ar_update.[Totaling]) > 0
I am trying to add variable values in WinAutomation into a spreadsheet by column header for every row that doesn't have a value. I've tried two different methods (insert into and update). I am getting the following error: "Runtime Error: Error in SQL Statement: Syntax error in INSERT INTO statement." Does anyone see something that I did wrong here that is causing said error?
INSERT INTO [Sheet1$]
[SAP Employee ID] VALUES(%SapEmployeeNumber%)
WHERE RowNumber IS null
UPDATE [Sheet1$] SET
([SAP Employee ID] = %SapEmployeeNumber%
,[Concur Travel] = %CreditOrOutofPocket%
,[Participant Name] = %ParticipantName%
,[Participant Birth Date] = %ParticipantBirth%
,[Work Location] = %ParticipantWorkLocation%
,[Street Address] = %ParticipantStreetAddress%
,[City] = %ParticipantCity%
,[State] = %ParticipantState%
,[Zip] = %ParticipantZip%
,[Participant Email] = %ParticipantEmail%
,[Contact Phone] = %ParticipantContactPhone%
,[Credit Card Profile] = %ParticipantCreditProfile%
,[Credit Limit] = %ParticipantCreditLimit% )
WHERE
[SAP Employee ID] IS NULL;
I'm stuck on a portion of code where I can not figure out how to use ISNULL correctly.
I'm trying to find all sales prices for an item by location and by variant code. The issue is that not all items with variants are priced in the sales price table at the variant level. I'm trying to say if there is no variant match, find where variant = ''.
SELECT [Item Ledger].[Location Code], [Item Ledger].[Item No_] AS "No_", [Item Ledger].[Variant Code]
, (SELECT [Item].[Description] FROM [Wings$Item] AS "Item" WHERE [Item].[No_] = [Item Ledger].[Item No_]) AS "Description"
, (SELECT [Item Variant].[Variant Dimension 1] FROM [Wings$Item Variant Registration] AS "Item Variant" WHERE [Item Variant].[Item No_] = [Item Ledger].[Item No_]
AND [Item Variant].[Variant] = [Item Ledger].[Variant Code]) AS "Color"
, (SELECT [Item Variant].[Variant Dimension 2] FROM [Wings$Item Variant Registration] AS "Item Variant" WHERE [Item Variant].[Item No_] = [Item Ledger].[Item No_]
AND [Item Variant].[Variant] = [Item Ledger].[Variant Code]) AS "Size"
, (SELECT [Item].[Vendor No_] FROM [Wings$Item] AS "Item" WHERE [Item].[No_] = [Item Ledger].[Item No_]) AS "Vendor No."
, (SELECT [Item].[Division Code] FROM [Wings$Item] AS "Item" WHERE [Item].[No_] = [Item Ledger].[Item No_]) AS "Division Code"
, (SELECT [Item].[Item Category Code] FROM [Wings$Item] AS "Item" WHERE [Item].[No_] = [Item Ledger].[Item No_]) AS "Item Category Code"
, (SELECT [Item Category].[Description] FROM [Wings$Item Category] AS "Item Category" WHERE [Item Category].[Code] = [Item Ledger].[Item Category Code]) AS "Item Cat. Description"
, (SELECT [Item].[Product Group Code] FROM [Wings$Item] AS "Item" WHERE [Item].[No_] = [Item Ledger].[Item No_]) AS "Product Group Code"
, (SELECT [Product Group].[Description] FROM [Wings$Product Group] AS "Product Group" WHERE [Product Group].[Code] = [Item Ledger].[Product Group Code]) AS "Prod. Group Description"
, (SELECT CAST([Item].[Last Direct Cost] AS decimal(18,2)) FROM [Wings$Item] AS "Item" WHERE [Item].[No_] = [Item Ledger].[Item No_]) AS "Last Cost"
, (SELECT DISTINCT CAST(MAX([Sales Price].[Unit Price]) as decimal(18,2))
FROM [Wings$Sales Price] AS "Sales Price", [Wings$Store Price Group] AS "Store Price"
WHERE EXISTS
(SELECT DISTINCT [Store Price].[Store]
, [Sales Price].[Item No_]
, (SELECT [Item].[Description] FROM [Wings$Item] AS "Item" WHERE [Item].[No_] = [Sales Price].[Item No_]) AS "Description"
, [Sales Price].[Variant Code]
, [Sales Price].[Sales Code]
, CAST([Sales Price].[Unit Price] as decimal(18,2)) AS "Unit Price"
FROM [Wings$Sales Price] AS "Sales Price" JOIN [Wings$Picking _ Receiving lines] AS "Picking Lines" ON [Sales Price].[Item No_] = [Picking Lines].[Item No_]
JOIN [Wings$Store Price Group] AS "Store Price" ON [Store Price].[Price Group Code] = [Sales Price].[Sales Code]
AND [Store Price].[Store] = [Picking Lines].[Shortcut Dimension 1 Code] WHERE [Sales Price].[Starting Date] > [Sales Price].[Ending Date])
AND [Store Price].[Store] = [Item Ledger].[Location Code] AND [Sales Price].[Item No_] = [Item Ledger].[Item No_]
AND [Sales Price].[Variant Code] = [Item Ledger].[Variant Code] AND [Store Price].[Price Group Code] = [Sales Price].[Sales Code]) AS "Retail Price"
, (SELECT MIN([Purch Rec].[Posting Date]) FROM [Wings$Purch_ Rcpt_ Line] AS "Purch Rec" WHERE [Purch Rec].[No_] = [Item Ledger].[Item No_] AND [Purch Rec].[Variant Code] = [Item Ledger].[Variant Code])
AS "First Rec Date"
, (SELECT MAX([Purch Rec].[Posting Date]) FROM [Wings$Purch_ Rcpt_ Line] AS "Purch Rec" WHERE [Purch Rec].[No_] = [Item Ledger].[Item No_] AND [Purch Rec].[Variant Code] = [Item Ledger].[Variant Code])
AS "Last Rec Date"
, (SELECT MAX([Sales Line].[Date]) FROM [Wings$Trans_ Sales Entry] AS "Sales Line" WHERE [Sales Line].[Item No_] = [Item Ledger].[Item No_] AND [Sales Line].[Variant Code] = [Item Ledger].[Variant Code]
AND [Sales Line].[Store No_] = [Item Ledger].[Location Code]) AS "Last Sold Date"
, (SELECT CAST(SUM([Value Entry].[Item Ledger Entry Quantity]) AS decimal(18,0)) FROM [Wings$Value Entry] AS "Value Entry" WHERE [Value Entry].[Item No_] = [Item Ledger].[Item No_]
AND [Value Entry].[Variant Code] = [Item Ledger].[Variant Code] AND [Value Entry].[Location Code] = [Item Ledger].[Location Code] AND [Value Entry].[Posting Date] <= '20161201') AS "Beg. Balance"
, (SELECT CAST(SUM([Transfer Shipment].[Quantity]) AS decimal(18,0)) FROM [Wings$Transfer Shipment Line] AS "Transfer Shipment" WHERE [Transfer Shipment].[Item No_] = [Item Ledger].[Item No_]
AND [Transfer Shipment].[Variant Code] = [Item Ledger].[Variant Code] AND [Transfer Shipment].[Transfer-from Code] = [Item Ledger].[Location Code]) AS "Outbound Transfers"
, (SELECT CAST(SUM([Transfer Receipt].[Quantity]) AS decimal(18,0)) FROM [Wings$Transfer Receipt Line] AS "Transfer Receipt" WHERE [Transfer Receipt].[Item No_] = [Item Ledger].[Item No_]
AND [Transfer Receipt].[Variant Code] = [Item Ledger].[Variant Code] AND [Transfer Receipt].[Transfer-to Code] = [Item Ledger].[Location Code]) AS "Inbound Transfers"
, (SELECT CAST(SUM([Purch. Rec.].[Quantity]) AS decimal(18,0)) FROM [Wings$Purch_ Rcpt_ Line] AS "Purch. Rec." WHERE [Purch. Rec.].[No_] = [Item Ledger].[Item No_]
AND [Purch. Rec.].[Variant Code] = [Item Ledger].[Variant Code] AND [Purch. Rec.].[Location Code] = [Item Ledger].[Location Code]) AS "YTD Purchase Receipts"
, (SELECT CAST(SUM([Transaction Register].[Quantity]) as decimal(18,0)) FROM [Wings$Trans_ Sales Entry] AS "Transaction Register"
WHERE [Item Ledger].[Item No_] = [Transaction Register].[Item No_] AND [Item Ledger].[Variant Code] = [Transaction Register].[Variant Code]
AND [Item Ledger].[Location Code] = [Transaction Register].[Store No_]) AS "YTD Sales"
, (SELECT CAST(SUM([Transaction Register].[Quantity]) as decimal(18,0)) FROM [Wings$Trans_ Sales Entry] AS "Transaction Register"
WHERE [Item Ledger].[Item No_] = [Transaction Register].[Item No_] AND [Item Ledger].[Variant Code] = [Transaction Register].[Variant Code]
AND [Item Ledger].[Location Code] = [Transaction Register].[Store No_] AND [Transaction Register].[Date] >= DATEADD(MONTH, DATEDIFF(MONTH, 0, GETDATE()) -1, 0)
AND [Transaction Register].[Date] < DATEADD(MONTH, DATEDIFF(MONTH, 0, GETDATE()) , 0)) AS "Last Month Sales"
, (SELECT CAST(SUM([Transaction Register].[Quantity]) as decimal(18,0)) FROM [Wings$Trans_ Sales Entry] AS "Transaction Register"
WHERE [Item Ledger].[Item No_] = [Transaction Register].[Item No_] AND [Item Ledger].[Variant Code] = [Transaction Register].[Variant Code]
AND [Item Ledger].[Location Code] = [Transaction Register].[Store No_] AND [Transaction Register].[Date] >= DATEADD(DAY, 1-DAY(GETDATE()), GETDATE())
AND [Transaction Register].[Date] < EOMONTH(GETDATE())) AS "Current Month Sales"
, (SELECT CAST(SUM([Transfer Line].[Outstanding Quantity]) AS decimal(18,0)) FROM [Wings$Transfer Line] AS "Transfer Line" WHERE [Transfer Line].[Item No_] = [Item Ledger].[Item No_]
AND [Transfer Line].[Variant Code] = [Item Ledger].[Variant Code] AND [Transfer Line].[Transfer-to Code] = [Item Ledger].[Location Code]) AS "Current In-Transit to Store"
, (SELECT CAST(SUM([Item Ledger].[Quantity]) as decimal(18,0))) AS "Current on Hand"
, (SELECT CAST(SUM([Value Entry].[Item Ledger Entry Quantity]) as decimal(18,0)) FROM [Wings$Value Entry] AS "Value Entry" WHERE [Value Entry].[Item No_] = [Item Ledger].[Item No_]
AND [Value Entry].[Variant Code] = [Item Ledger].[Variant Code] AND [Value Entry].[Location Code] = [Item Ledger].[Location Code] AND [Value Entry].[Location Code] LIKE '9%') AS "Whse Inv."
, (SELECT CAST(SUM([Value Entry].[Item Ledger Entry Quantity]) as decimal(18,0)) FROM [Wings$Value Entry] AS "Value Entry" WHERE [Value Entry].[Item No_] = [Item Ledger].[Item No_]
AND [Value Entry].[Variant Code] = [Item Ledger].[Variant Code] AND [Value Entry].[Location Code] = [Item Ledger].[Location Code] AND [Value Entry].[Location Code] NOT LIKE '9%') AS "Store Inv."
, (SELECT CAST(SUM([Purchase Line].[Outstanding Quantity]) as decimal(18,0)) FROM [Wings$Purchase Line] AS "Purchase Line" WHERE [Item Ledger].[Item No_] = [Purchase Line].[No_]
AND [Purchase Line].[Location Code] = [Item Ledger].[Location Code] AND [Purchase Line].[Variant Code] = [Item Ledger].[Variant Code]) AS "Qty. on PO"
FROM [Wings$Item Ledger Entry] AS "Item Ledger", [Wings$Store Price Group] AS "Store Price" WHERE [Item Ledger].[Location Code] = [Store Price].[Store] AND [Item Ledger].[Location Code] = [Store Price].[Store]
GROUP BY [Item Ledger].[Location Code], [Item Ledger].[Item No_], [Item Ledger].[Variant Code], [Item Ledger].[Item Category Code], [Item Ledger].[Product Group Code], [Store Price].[Price Group Code], [Store Price].[Store]
My Scenario: I have a Scenario where I need to generate a text tab delimited file using SSIS, the source data is coming from SQL query.
Problem: I have generated the text clean text file but I am getting a empty row at the end of file, I need to remove that line, I checked my sql query results there are no blank rows in it. can anyone please suggest me what should I do?
Source Query:
SELECT
CASE
WHEN DATEPART(WEEKDAY,GETDATE()) = 2 THEN LTRIM(RTRIM(CONVERT(DATE,DATEADD(D,-3,GETDATE()),126)))
WHEN DATEPART(WEEKDAY,GETDATE()) = 3 THEN LTRIM(RTRIM(CONVERT(DATE,DATEADD(D,-1,GETDATE()),126)))
WHEN DATEPART(WEEKDAY,GETDATE()) = 4 THEN LTRIM(RTRIM(CONVERT(DATE,DATEADD(D,-1,GETDATE()),126)))
WHEN DATEPART(WEEKDAY,GETDATE()) = 5 THEN LTRIM(RTRIM(CONVERT(DATE,DATEADD(D,-1,GETDATE()),126)))
WHEN DATEPART(WEEKDAY,GETDATE()) = 6 THEN LTRIM(RTRIM(CONVERT(DATE,DATEADD(D,-1,GETDATE()),126)))
ELSE ''
END AS [COB Date],
LTRIM(RTRIM('1802')) AS Branch,
LTRIM(RTRIM(CIF)) AS [Client Id],
LTRIM(RTRIM(CRM.[Limit ID])) AS [LIMIT ID],
LTRIM(RTRIM([TRANSACTION])) AS [Account Id],
CASE [DEMAND-TERM] WHEN 'DEMAND' THEN LTRIM(RTRIM('316')) ELSE LTRIM(RTRIM('319')) END AS [Account Type],
LTRIM(RTRIM(CONVERT(DATE,CRM.[Start Date]))) AS [Start Date],
CASE WHEN LTRIM(RTRIM(LD.[TRANSACTION])) LIKE ('1%') THEN
CASE
WHEN LTRIM(RTRIM(CRM.[Expiry Date])) = '22220222' AND DATEPART(WEEKDAY,GETDATE()) = 2 OR CRM.[Expiry Date] = '' THEN LTRIM(RTRIM(DATEADD(DAY,1,CONVERT(DATE,GETDATE()))))
WHEN LTRIM(RTRIM(CRM.[Expiry Date])) = '22220222' AND DATEPART(WEEKDAY,GETDATE()) = 3 OR CRM.[Expiry Date] = '' THEN LTRIM(RTRIM(DATEADD(DAY,1,CONVERT(DATE,GETDATE()))))
WHEN LTRIM(RTRIM(CRM.[Expiry Date])) = '22220222' AND DATEPART(WEEKDAY,GETDATE()) = 4 OR CRM.[Expiry Date] = '' THEN LTRIM(RTRIM(DATEADD(DAY,1,CONVERT(DATE,GETDATE()))))
WHEN LTRIM(RTRIM(CRM.[Expiry Date])) = '22220222' AND DATEPART(WEEKDAY,GETDATE()) = 5 OR CRM.[Expiry Date] = '' THEN LTRIM(RTRIM(DATEADD(DAY,1,CONVERT(DATE,GETDATE()))))
WHEN LTRIM(RTRIM(CRM.[Expiry Date])) = '22220222' AND DATEPART(WEEKDAY,GETDATE()) = 6 OR CRM.[Expiry Date] = '' THEN LTRIM(RTRIM(DATEADD(DAY,3,CONVERT(DATE,GETDATE()))))
WHEN LTRIM(RTRIM(CRM.[Expiry Date])) = '22220222' AND DATEPART(WEEKDAY,GETDATE()) = 7 OR CRM.[Expiry Date] = '' THEN LTRIM(RTRIM(DATEADD(DAY,2,CONVERT(DATE,GETDATE()))))
WHEN LTRIM(RTRIM(CRM.[Expiry Date])) = '22220222' AND DATEPART(WEEKDAY,GETDATE()) = 1 OR CRM.[Expiry Date] = '' THEN LTRIM(RTRIM(DATEADD(DAY,1,CONVERT(DATE,GETDATE()))))
ELSE CONVERT(DATE,CRM.[Expiry Date]) END ELSE LTRIM(RTRIM(CONVERT(DATE,LD.[OUTSTANDING-MATURITY-DATE]))) END AS [Maturity Date],
LTRIM(RTRIM(CCY)) AS [Account Currency],
LTRIM(RTRIM(OUTSTANDING)) AS [Amount],
LTRIM(RTRIM('D')) AS [Debit Credit],
CASE WHEN [CIF] = '100665' THEN LTRIM(RTRIM('286')) ELSE LTRIM(RTRIM('285')) END AS [Product Code]
FROM [LOAN.DETAIL] LD
LEFT JOIN t_CRM_MONTHLY_RPT_NY CRM
ON LD.[LIMIT-ID] = CRM.[Limit ID]
WHERE ([RM-AREA] = 'UHNN')
Destination file:
I need only 49 rows not 50 rows.
How can I do this?