Results 1 to 2 of 2

Thread: Stocks

  1. #1
    Join Date
    Jan 2013
    Posts
    2

    Unanswered: Stocks

    I have a database full with stock 1 – minute result.
    I want to take out per date the lowest in LOW and IF more than once per date.
    The result I’m interested of is date, time and low.

    Table
    https://www.box.com/s/8w5co5hhy3gtl3fqfqse

    Result with: SELECT Date, ROUND(MIN(Low),2) AS Low FROM test.ABB GROUP BY Date DESC;
    https://www.box.com/s/sg4sd9sm4rie91dzt4ja

    Table
    `Date` date NOT NULL,
    `Time` time NOT NULL,
    `Open` float NOT NULL,
    `High` float NOT NULL,
    `Low` float NOT NULL,
    `Close` float NOT NULL,
    `Vol` float NOT NULL,
    PRIMARY KEY (`Date`,`Time`)

    Problem is that I want all result of min(LOW) if It take place more than once per date. How do I best “loop” it so I get the result I want? Temp Table?

  2. #2
    Join Date
    Jan 2013
    Posts
    2

    Solved

    Solved, or one of many solutions.

    select a.date, a.time, round(a.low,2) as low
    from abb a
    join (
    select date, min(low) as low
    from abb
    group by date
    ) b on a.date=b.date and a.low=b.low
    order by a.date asc, a.time asc, a.low desc;

Posting Permissions

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