Skip to Content
author's profile photo Former Member
Former Member

Aggregation level sql script.

Hi,

I am pretty new to sql script in hana . I have a requirement in which i have to write a sql script on the below conditions.

Category

type

east

west

North

South

central

others

10

100

100

200

300

400

500

890

10

200

100

200

300

400

500

890

20

300

200

300

400

500

890

500

10

100

100

200

300

400

500

890

20

200

200

300

400

500

890

500

10

300

100

200

300

400

500

890

20

100

200

300

400

500

890

500

1- check for types (100, 200, 300)

2-. If type 100, read all the rates east,west,north,south,central

sum it and sent it back to some output a1

3-. If type 200 or 300, then read other... sum it and sent back to some output b1




Regards,

Richard

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Jul 25, 2016 at 02:51 PM

    Hello Richard,

    can you please add a little bit more information who your expected result should look like.

    E.g.

    • Do you require to different result sets or one result set?
    • Is only a horizontal aggregation of the column values necessary per line or should there be also a grouping over some attributes (e.g. type)?

    From what I think you wanna have, everything can be archived using standard SQL.

    Thx,

    Florian

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 26, 2016 at 03:45 AM

    Hi Richard

    as you've posted this question not just here but also on stackoverflow I feel a comment is required here.

    SCN is very outspokenly a professional's community. This doesn't mean that everyone participating needs to be an expert or knowledgeable in details of some technology (although this never hurts).

    What it does mean though is that there is the expectation of a professional approach to challenges.

    This includes doing your own research and homework before asking others to help you out.

    We value this bit of problem handling so highly in SCN, that failing on it actually is a reason to moderate questions. (see the The SCN Rules of Engagement for all the details).

    To be quite frank here: if the question would not have been answered already, it would have been moderated. In it's current form it is what we call "spec dump". It's throwing your mess over somebody else's fence to be sorted out.

    That's not professional at all and not what this community (or stackoverflow for that matter) is looking for.

    In contrast even "guerrilla tactics" like "to get correct answers, I don't just post a question, but I post the answer, that I already know it doesn't work (because I tried it) and claim it's the right one. that's attracting tons of people who feel the urge to correct it" are a lot better then the approach you've taken, as at least there had been some effort been put in from your side.

    Looking at the question and how easy the answer is with standard SQL I assume you're fairly new to the topic. That's of course perfectly fine, but I highly recommend to invest a bit more effort into researching your issues next time. Not only will it allow you to explain much better what you want to achieve, what you've tried and where you struggle, but also it is the approach that is a lot more professional.

    After all, you don't want to be seen as the dude who goes around, stumbling helplessly over simple questions and needs others to fix even the most beginner level stuff for him, do you?

    Cheers,

    Lars

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.