Consulting

Results 1 to 3 of 3

Thread: Query for retrieving limited records

  1. #1

    Query for retrieving limited records

    Hello All,
    I am working with SAP HANA tables and I have a problem in writing the query to get selected records from the table which has >1 million records. The following is the brief SQL query for the table:

    SELECT
    "MEASURINGDOC",
    "READ_DATE",
    "MEASURING_READ",
    "MESURING_POINT",
    FROM "MEASURING_DOCUMENTS"

    Each "MESURING_POINT" has multiple "MEASURINGDOC" entries with the readings taken on "READ_DATE" and values recorded as "MEASURING_READ". Each "MESURING_POINT" has a frequency period in which the Readings are taken. Some are weekly, some are monthly, some are quarterly and some are taken when investigating a problem.
    From the above table I want to create a query to take out the most recent 10 "MEASURING_READ" for each "MEASURING_POINT". This is to plot a chart for each "MESURING_POINT", the "MEASURING_READ"s over a period of time.
    As the time intervals are different for each "MEASURING_POINT", I cannot use the "READ_DATE" for all "MEASURING_POINTS" to filter the results.
    I think we may have to use UNION query, but my knowledge of SQL is limited.
    Will the experts suggest a solution?
    Thank you in advance

    krishna

  2. #2
    VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,709
    Location
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  3. #3
    Thanks for the reply. Your tutorial is great... it deals with the explanation of the basic functions of SQL.
    I need a solution to the specific issue I am facing.
    Can you help me with the correct clause?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •