Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

sql statement mysql joint to table and sum

Avatar of teera
teera asked on
PHPSQL
1 Comment1 Solution375 ViewsLast Modified:
i have 2  table sale , and payment how can i joint to table when iI sale customer sometime paymeny time for some item so i should have table payment to record it  how can i write sql statement like merk statement

sale.preselRef    sale.name  sale.grandtotal   sum from table payment group by saleid (match with sale.preselRef )
-- Table structure for table `sale`
--

CREATE TABLE IF NOT EXISTS `sale` (
  `preselRef` int(12) NOT NULL,
  `nameid` int(11) DEFAULT NULL,
  `name` varchar(255) DEFAULT NULL,
     -----
   `grandtotal` decimal(10,2) DEFAULT NULL,


CREATE TABLE IF NOT EXISTS `payment` (
  `id` int(11) NOT NULL,
  `saleid` int(11) NOT NULL,
  `type` varchar(80) COLLATE utf8_bin NOT NULL,
  `amount` decimal(11,2) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
ASKER CERTIFIED SOLUTION
Avatar of Sharath S
Sharath SFlag of United States of America imageData Engineer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 1 Comment.
See Answers