473,511 Members | 10,195 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to handle null columns while using minus

1 New Member
Expand|Select|Wrap|Line Numbers
  1. select distinct item_code ,item_description ,item_type_name,item_group_name
  2. from tblitemmaster
  3. minus
  4. select distinct item_code ,item_description ,to_char(null) as item_type_name, to_char(null) as item_group_name
  5. from tblbinlocation  
  6. where transaction_type in('Indent','MDN')
  7. and voucher_date 
  8. between TO_CHAR(TO_DATE('01-03-2014', 'DD-MM-YYYY')) 
  9. and TO_CHAR(TO_DATE('31-08-2014', 'DD-MM-YYYY'))
The above query getting wrong output,it will display all records from tblitemmaster table,if it is not use null colums ,minus getting perfect output.

Insted of the above query am using not exists

Expand|Select|Wrap|Line Numbers
  1. select distinct item_code ,item_description,item_type_name,item_group_name
  2. from tblitemmaster
  3. where not exists (select distinct item_code from tblbinlocation
  4. where tblitemmaster.item_code = tblbinlocation.item_code 
  5. and transaction_type in('Indent','MDN') and 
  6. voucher_date  
  7. between TO_CHAR(TO_DATE('01-03-2014', 'DD-MM-YYYY')) 
  8. and TO_CHAR(TO_DATE('31-08-2014', 'DD-MM-YYYY')))
But,the above query getting correct output.

Minus and not exists concepts are same.but,the two queries are getting different output.2nd query only correct output.
How to alter the 1st query and i want correct result like 2nd query.
Thanks in advance.
Sep 2 '14 #1
1 8306
mukherjee
9 New Member
You may try to use ISNULL(column, value) method.
Sep 9 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
15668
by: Tom Urbanowicz | last post by:
I have a table with 100+ columns, for which I'm trying to retrieve only 1 specific record. For this single record, I do not know which of the columns are NULL, and which are populated. I would...
2
864
by: Jason Coyne Gaijin42 | last post by:
I have seen several people looking for a way to access the Columns collection when using the AutoGenerate = true option. Some people have gotten so far as to find the private autoGenColumnsArray...
0
1174
by: Andla Rand | last post by:
Hi, How to add new columns using an ArrayList without creating a class ? Notice: bc.DataField="!" works when AutoGenerateColumns is off. Otherwise nothing is displayed. ArrayList a=new...
11
34448
by: eddy de boer | last post by:
Hello, in my aspx page I have the followong code: <asp:Repeater id="Repeater1" runat="server"> <ItemTemplate> .... <%# Server.HtmlDecode((string)DataBinder.Eval(Container.DataItem,"tekst"))...
6
12980
by: Dean Slindee | last post by:
I am looking for the "right" way to handle inserting and presenting null date values. Public Const c_NullDate As Date = #12:00:00 AM# If I set the value of a date variable in an SQL Server insert...
4
5304
Haitashi
by: Haitashi | last post by:
Hi: I need to dymanically create a number of columns using the queryAddColumn function. I was going to use the loop below. That way each column would have a generic dynamically created name. ...
0
2362
by: Orbie | last post by:
Hi Guys, I need some help with pivoting or converting some rows on a Table into columns using SQL Server 2008! I have a Table which contains the same Products in 4 different Stores. I'm only...
1
2247
by: NareshN | last post by:
Hi, I am using this stored procedure with pivot.If i dont have data i am getting null with this stored procedure.Can u tell me how to handle null.below query is pivot. I am using like...
1
4670
by: santhanalakshmi | last post by:
Hi, I uploaded the excel and the data is successfully inserted to the database, by submitting the "submit button" using php script. There is an final stage for me to do is the validation of...
1
3187
by: Alien | last post by:
Hi guys, I am trying to work out how MYSQL deals with NULL values. When a new column is inserted on a table already populated with records (40,000 in my case), and I specify it as NOT NULL,...
0
7367
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7089
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5673
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5072
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3230
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3217
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
790
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
451
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.