I have a table name Table1 which contain columns Cust_no,
car_model, country, salesamt. The records are 101, Fiat,
India, 12345
2nd record is 102, Tata, USA, 98743 3rd record is 101,
indica, India, 65342 4th record is 103, Toyota, UK, 64522
5th record is 103, Maruti, USA, 98632 and so on.....
Now my question is write sql query which will give me
detail about the sum of sales amount in perticular country
Answers were Sorted based on User's Feedback
Answer / satty
select country,sum(salesamt) from table1 groupby country;
but if its primary key is cust-no, then it will show error
-803 try to insert duplicates in primary key value.
| Is This Answer Correct ? | 4 Yes | 0 No |
Answer / raghu
select country,sum(salesamt) from table1 where country = ind;
| Is This Answer Correct ? | 0 Yes | 1 No |
db2 query I have one table with the following details. SNO SNAME DOJ ------ -------------------- ---------- 10 KRISH 2007-03-19 20 REDDY 2007-05-19 30 RRRRR 2007-05-19 40 BBBBB 2008-05-19 50 CCCCC 2009-05-19 60 JJJJJ 2009-05-19 70 JJJJJ 2004-05-19 i want the output in the following format:( no of students joined in each year(no nedd to consider about month and date) year count --------- ---------- 2004 1 2007 3 2008 1 2009 2
What is the use of COMMAREA ?Minimum how much data we can pass from it?
What is sqlcode -922 ?
Can a unique index have more than one null value? If not, what error code is given if an attempt is made to insert more than one null value?
how can u nderstand the sql stmts executed successfully or not ?
What action db2 takes when a program aborts in the middle of a transaction?
How is deadlock resolved?
the dd name for ksds is dest1 and what is the dd name for alternate index of ksds ? a.dest b.dest1 c.dest1a d.dd1
How does a cursor work?
I have two tables A and B. Both tables are connected with SSN number as foreign key. I want to retrieve a column data from B table. How will you write a query?
OUTER JOINS USED TO GET MATCHING AND NONMATCHING ROWS FORM 2 OR MORE TABLES BASED ON COLUMNS. SIMPLE JOINS ALSO DO THE SAME THEN WHAT IS THE USE OF OUTER JOINS.
What is the difference between a package and a plan?
6 Answers Infosys, L&T, Mphasis,