Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7689807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:15:02+00:00 2026-05-31T20:15:02+00:00

I want to fetch NULL values in Mysql . My query is like this-:

  • 0

I want to fetch NULL values in Mysql.
My query is like this-:

Select sc.message 
FROM shipping_comment sc,
sales_flat_order sfo
where sfo.shipping_comment_id = sc.shipping_comment_id
AND sfo.increment_id = 100000429

so If for the order no. 100000429 if customer given comment then it is showing correctly like below-:

   message
   sample comment ok

but say for any order, customer didn’t give any comment. Say for another id 100000430. Then in sfo.shipping_comment_id value is stored in database as NULL. So how to fetch NULL for sc.message so that my output will be for order no. 100000430-:

message
NULL

One more problem is that shipping_comment (sc) only stores comments for which there is comment for order & for those only generate shipping_comment_id. So if there is no comment for order, there is no existence of any data in shipping comment table for that order. & for table sales_flat_order(sfo) if there is no comment for order, it store value is shipping_comment_id=NULL.
So in that case where condition become-:

NULL=sc.shipping_comment_id

which is not taken by sc.message.

So how can I fetch NULL values in mysql table???
plz guide me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T20:15:03+00:00Added an answer on May 31, 2026 at 8:15 pm

    I’m not sure what is the problem with your query? For the given order no. 100000429, your query will return the message if there is one in “shipping_comment”; otherwise it will return an empty result set.

    Anyways, if you want to retrieve all order numbers and their comments, if any, this query should help:

    SELECT `sfo`.*, `sc`.`message`
    FROM `sales_flat_order` `sfo`
    LEFT JOIN `shipping_comment` `sc` ON `sfo`.`shipping_comment_id` = `sc`.`shipping_comment_id`;
    

    It will need a LEFT JOIN to return all orders.

    Hope it helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want to fetch information from the database using objects. i really like this
I want to fetch the unmatching records from two table in SQL, the table
In asp.net(C#) i want to fetch data from a database using a stored procedure
I want to get all the image_name values from one of my tables where
Can someone suggest me a good example or link to select records from MySQL
I want fetch last record using hibernate criteria Can u help me?
I want to fetch the title of a webpage which I open using urllib2.
I want to fetch a method's comments,take below method for example: /** * Returns
I want to fetch the id of a one-to-one relationship without loading the entire
I got a Wikipedia article and I want to fetch the first z lines

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.