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 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 the following php code that gets a serialized array from a mysql
I have a legacy PHP/MySQL app that calls mysql_connect(). Tons of existing downstream code
I have a bunch of code that needs transitioned from PHP's mysql_* to mysqli_*
I have a massive amount of data that needs to be read from mysql,
I have this mySQL code that connects to my server. It connects just fine:
The code below works great. I have a MySQL database that contains book titles
I have this piece of php - mysql code: When a user tagged in
Here my code, I need to insert into mysql database I have mysql,php,android 1)
For eg, I have this code for my PHP calendar events application. /**MySQL code
I have a script file for MySQL that needs to be run on about

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.