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 7925157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T18:09:37+00:00 2026-06-03T18:09:37+00:00

Im making a table generator as a school project. In MySQL I have 3

  • 0

Im making a table generator as a school project.
In MySQL I have 3 tables namely process,operation,score. Everything looked fine until i tested out my “ADD column” button in the web app.
Previous saved data should be read properly but also include the new column in the format, problem is the previous data queried does not include any values for the new table, so I intended it to return a score of 0 if no records were found, tried IFNULL & COALESCE but nothing happens(maybe im just using it wrong)

  • process – processID, processName
  • operation – operationID, operationName
  • score – scoreID, score, processID, operationID, scoreType (score
    types are SELF,GL,FINAL)

    ps = (PreparedStatement)dbconn.prepareStatement(“SELECT score FROM score WHERE processID=? and operationID=? and type=?ORDER BY processid”);

here’s a pic of a small sample http://i50.tinypic.com/2yv3rf9.jpg

  • 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-06-03T18:09:39+00:00Added an answer on June 3, 2026 at 6:09 pm

    The reason that IFNULL doesn’t work is that it only has an effect on values. A result set with no rows has no values, so it does nothing.

    First, it’s probably better to do this on the client than on the server. But if you have to do it on the server, there’s a couple of approaches I can think of.

    Try this:

    SELECT IFNULL(SUM(score), 0) AS score
    FROM score
    WHERE processID=? and operationID=? and type=?
    ORDER BY processid
    

    The SUM ensures that exactly one row will be returned.

    If you need to return multiple rows when the table contains multiple matching rows then you can use this (omitting the ORDER BY for simplicity):

    SELECT score
    FROM score
    WHERE processID = ? and operationID = ? and type = ?
    
    UNION ALL
    
    SELECT 0
    FROM (SELECT 0) T1
    WHERE NOT EXISTS
    (
        SELECT *
        FROM score
        WHERE processID = ? and operationID = ? and type = ?
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making a project on a restaurant where I have put table reservation.
I'm modelling MySQL database for an website. I'm now making 'people' table, and deciding
I have look-up-table as defined below and I'm making use of GCC. When I
I have these 3 tables: users table(PK user_id) Fields: user_id, user_first_name, user_last_name, username, user_email...etc
I have the following mapped classes: <class name=Company table=Company> <id name=ID column=CompanyID> <generator class=native/>
I am making a classifieds website... I have these 6 tables: Every category has
I am trying to exclude nested tables from my table striping (making every other
For a school project I'm making a simple Job Listing website in ASP.NET MVC
I am making a table in which you can add aditional rows. When you
Im having trouble making my table contents vertically aligned and was wondering if you

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.