February 2, 2016 at 4:59 am
I've table as following, -- see attachment data.zip
CREATE TABLE [dbo].[crpt_Test](
[batch_Id] [uniqueidentifier] NULL,
[param1] [nvarchar](200) NULL,
[param2] [nvarchar](200) NULL,
[group_chart_code_1] [int] NULL,
[group_chart_code_2] [int] NULL,
[group_chart_code_3] [int] NULL,
[group_chart_code_4] [int] NULL,
[cmpy_code] [nchar](10) NULL,
[chart_code] [nvarchar](5) NULL,
[year_num] [nvarchar](10) NULL,
[pusat_kos] [nvarchar](50) NULL,
[jour_code] [nvarchar](10) NULL,
[jour_num] [nvarchar](50) NULL,
[jour_seq_num] [int] NULL,
[desc_text] [nvarchar](50) NULL,
[debit_amt_year1] [decimal](14, 2) NULL,
[credit_amt_year1] [decimal](14, 2) NULL,
[debit_amt_year2] [decimal](14, 2) NULL,
[credit_amt_year2] [decimal](14, 2) NULL
) ON [PRIMARY]
I execute SQL as following,
select *
from crpt_Test
where batch_Id='76D79E5E-07A6-4B8E-964F-6287DC4873F9'
AND chart_code>='10000' AND chart_code<='13000'
My chart_code range is chart_code>='10000' AND chart_code<='13000'
I want to do Exception between chart_code range. I want to except value as following
1- != 12101
2- != 12110
3- != 12116
Please help me to adjust my
select *
from crpt_Test
where batch_Id='76D79E5E-07A6-4B8E-964F-6287DC4873F9'
AND chart_code>='10000' AND chart_code<='13000'
including Exception
How to do that? Please help
February 2, 2016 at 5:35 am
SELECT *
FROM crpt_Test
WHERE batch_Id = '76D79E5E-07A6-4B8E-964F-6287DC4873F9'
AND chart_code BETWEEN '10000' AND '13000'
AND chart_code NOT IN ('12101','12110','12116')
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply