i have a table like sales....the field are
Prodid Jan(jam month sales)Feb March apr may jun july
1 20 76 50 74 94 93 83
2 30 94 40 94 93 93 02
3 40 90 30 49 94 92 56
4 70 20 30 93 46 35 78
5 23 40 40 39 84 46 57
6 85 30 55 93 46 46 46
7 84 20 65 83 56 57 57
8 10 93 40 93 68 57 36
9 57 30 30 83 67 57 79
10 38 83 40 83 55 68 47
11 35 39 90 94 57 78 47
12 83 89 50 93 79 69 69
i wat ti find the max sales of every product which i want to
load into target table
Answer Posted / rkraju
hi.,the query is
>>select case when jan>feb and jan>mar and jan> apr and jan>
may and jan>jun then
jan else (case when feb>jan and feb>mar and feb>apr and
feb>may and feb>jun then
feb else (case when mar>jan and mar>feb and mar>apr and
mar>may and mar>jun then
mar else (case when apr>jan and apr>feb and apr>mar and
apr>may and apr>jun then
apr else (case when may>jan and may>feb and may>apr and
may>mar and may>jun then
may else (case when jun>jan and jun>feb and jun>mar and
jun>apr and jun>may then
jun end)end)end)end)end)end from sales;
select case when jan>feb and jan>mar and jan> apr and jan>
may and jan>jun then
jan else (case when feb>jan and feb>mar and feb>apr and
feb>may and feb>jun then
feb else (case when mar>jan and mar>feb and mar>apr and
mar>may and mar>jun then
mar else (case when apr>jan and apr>feb and apr>mar and
apr>may and apr>jun then
apr else (case when may>jan and may>feb and may>apr and
may>mar and may>jun then
may else (case when jun>jan and jun>feb and jun>mar and
jun>apr and jun>may then
jun end)end)end)end)end)end from sales;
like this u can find max sal upto dec .,i hope this query
fulfill ur req.,
Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What is spool space? Why do you get spool space errors?
What are types of partition primary index (ppi) in teradata?
Explain the term 'row' related to relational database management system?
What is database exceptions in teradata?
What is smp and mpp platforms?
What is a three-tier data warehouse?
Can we collect statistics on multiple columns?
What are the multiload utility limitations?
If the PMON is not working then how do you identify and monitor all the processes, resources and sessions ?
Define views in teradata with general syntax.
How to eliminate product joins in a teradata sql query?
What is called partitioned primary index (ppi)?
what is object level locking ? where do appear this type of locking ?
What do you mean by tpt in teradata?
How do you verify a complicated sql?