473,394 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How to handle null columns while using minus

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 8264
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
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
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
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
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
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
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
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
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
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
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...

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.