Hitachi Vantara Pentaho Community Forums
Results 1 to 6 of 6

Thread: Database lookup limit 1

  1. #1

    Default Database lookup limit 1

    hi

    I have to lookup my ipdatabase using
    SELECT `ip_start` FROM `ip_group_country` where `ip_start` <= FIELD order by ip_start desc limit 1;

    By using the database lookup, I might get several rows because it not support limit 1;
    I know I can use sql script, but have to define the parameters for FIELD each row;

    Is there anyway to get this done by Lookup?

    Thanks

    Alex

  2. #2
    Join Date
    May 2006
    Posts
    4,882

    Default

    db join step?

  3. #3

    Default

    database lookup step
    seem the pb is solved, by addint with 'order by desc' the step by defaut get the first row correspond

  4. #4
    Join Date
    Feb 2009
    Posts
    321

    Default

    yes the db lookup get the first row.
    anyway you can do this with the step sql script. if you have parameters, you must defined in a previous transformation (step set variables). Later in a sql script, recover the parameter in this way '${PARAMETERS}'
    Last edited by hernanthiebaut; 08-05-2009 at 09:05 AM.

  5. #5
    Join Date
    Nov 1999
    Posts
    9,729

    Default

    anyway you can do this with the step sql script
    Oi, hernanthiebaut, Noooo!!!!

    Use the "DB Join" step instead. The SQL script, scripts SQL in the form of dynamic SQL which is always slow. It's designed for those occasions when you need to create/update/delete a bunch of partitions, tables, indexes dynamically.

  6. #6
    Join Date
    Feb 2009
    Posts
    321

    Default

    matt, I know... this is not the best option, only intended to clarify what he said... but that`s works or not?...
    The step sql script almost always can be avoided with another steps...
    sorry if you misunderstood...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.