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

  • Home
  • SEARCH
  • 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 1015551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:25:03+00:00 2026-05-16T10:25:03+00:00

I have a mysql code that needs to be improved because of my limited

  • 0

I have a mysql code that needs to be improved because of my limited knowledge. I am new in php-mysql.I have data arrays at my DB and I want to show data such as:

Date             Model        Qty         Name
2010-08-23       boo          2          Steve
2010-08-24       boo          1          Steve
2010-08-25       boo          2          David
2010-08-25       blob         1          Steve

I have tried using this code, but the results is not like what I wanted.

"SELECT id, DATE(A.Inspection_datetime) AS Date,
                  A.Model, COUNT(A.Serial_number) AS Qty,
                  B.name
                  FROM inspection_report AS A
                  LEFT JOIN Employee AS B
                  ON A.NIK=B.NIK
                  GROUP BY A.Model, B.name, A.Inspection_datetime"
results:
Date             Model        Qty         Name
2010-08-23       boo          1          Steve
2010-08-23       boo          1          Steve
2010-08-24       boo          1          Steve
2010-08-25       boo          1          David
2010-08-25       boo          1          David
2010-08-25       blob         1          Steve

How do I do to resolve this problem?

     CREATE TABLE IF NOT EXISTS `inspection_report` (
          `id` int(11) NOT NULL AUTO_INCREMENT,
          `Model` varchar(14) NOT NULL,
          `Serial_number` varchar(8) NOT NULL,
          `Lot_no` varchar(6) NOT NULL,
          `Line` char(5) NOT NULL,
          `Shift` char(1) NOT NULL,
          `Inspection_datetime` datetime NOT NULL,
          `Range_sampling` varchar(19) NOT NULL,
          `NIK` int(5) NOT NULL,
          `Class` char(1) NOT NULL,
          `Status` varchar(6) NOT NULL,
          PRIMARY KEY (`id`),
          UNIQUE KEY `Model` (`Model`,`Serial_number`,`Lot_no`,`Line`)
        ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=44 ;

        CREATE TABLE IF NOT EXISTS `Employee` (
      `NIK` char(5) NOT NULL,
      `name` varchar(50) NOT NULL,
      PRIMARY KEY (`NIK`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
  • 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-16T10:25:04+00:00Added an answer on May 16, 2026 at 10:25 am
    SELECT id, DATE(A.Inspection_datetime) AS Date,
                      A.Model, COUNT(A.Serial_number) AS Qty,
                      B.name
                      FROM inspection_report AS A
                      LEFT JOIN Employee AS B
                      ON A.NIK=B.NIK
                      GROUP BY Date,B.name
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some code which needs to ensure some data is in a mysql
I have code with the following form: <?php function doSomething{ //Do stuff with MySQL
I have a MySQL database of keywords that are presently mixed-case. However, I want
I have a MySQL query that returns a result with a single column of
I have this code while($row = mysql_fetch_row($result)) { echo '<tr>'; $pk = $row[0]['ARTICLE_NO']; foreach($row
I have the following code, for which I get the error: Warning : mysqli_stmt::bind_result()
Anyone knows how to get sum of number? For example i have mysql column
I have a MySQL table with approximately 3000 rows per user. One of the
I have a MySQL database behind a firewall which can only be accessed via
I have a MySQL database table with a couple thousand rows. The table is

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.