Query not to show null fields

sibbbra

Member
Local time
Today, 08:23
Joined
Feb 11, 2022
Messages
78
hi,
I ahve a simple query:
1646393817238.png

I want that the order ID 144 and 145 should show only , with 1000 and 400 amount and the last 2 columns with null values to be dropped.
It should show as
1646394033879.png

the SQL is
SELECT Orders.Order_ID, Orders.Order_Date, Orders.Amount_Cash_Customer, Orders.Amount_Cash_Supplier
FROM Orders;
;;;;; please help, how to do that ;;;;;
 
I want that the order ID 144 and 145 should show only , with 1000 and 400 amount and the last 2 columns with null values to be dropped.
SQL:
SELECT Order_ID, Order_Date, Amount_Cash_Customer, Amount_Cash_Supplier
FROM Orders
WHERE
     (Amount_Cash_Customer = 1000)
     OR
     (Amount_Cash_Supplier = 400);
 
I want that the order ID 144 and 145 should show only , with 1000 and 400
Although @Eugene-LS solution is correct, I have to assume that is not really what you want. Seems pretty specific and not of much use.

Maybe you really are looking to return records where you have a value in either field greater than 0? FYI you do not have any Null values. You have values of 0. Very different.

Code:
WHERE Amount_Cash_Customer > 0 or Amount_Cash_Supplier > 0
 
should be OR:

SELECT Order_ID, Order_Date, Amount_Cash_Customer, Amount_Cash_Supplier
FROM Orders
WHERE
Amount_Cash_Customer <> 0
OR
Amount_Cash_Supplier <> 0;
 
Although @Eugene-LS solution is correct, I have to assume that is not really what you want. Seems pretty specific and not of much use.

Maybe you really are looking to return records where you have a value in either field greater than 0? FYI you do not have any Null values. You have values of 0. Very different.

Code:
WHERE Amount_Cash_Customer > 0 or Amount_Cash_Supplier > 0
So kind of you. It helped
 
I did EXACTLY what TC asked (although there were doubts)
You read the first half of the question but not the second. The second half plus common sense would have suggested that you give some weight to your doubts.

You always have to read between the lines when answering questions and don't just blindly answer the specific question
 
Oh, I Understand now. Did not see the And only the Or.
I keep forgetting to write myself a poster:
"Before you turn on your computer - Don't forget to turn on your brain!" :)
 
The desire to help lives within all of us who answer questions here:)
 
he desire to help lives within all of us who answer questions here
I agree with you again!
But there is also a "human factor" - because we are all human...
...
I think the "human factor" makes everything more interesting...
 

Users who are viewing this thread

Back
Top Bottom