NAME

SQL::Statement::Functions::ArgMinMax - ARGMIN*/ARGMAX* functions

VERSION

This document describes version 0.002 of SQL::Statement::Functions::ArgMinMax (from Perl distribution SQL-Statement-Functions-ArgMinMax), released on 2017-01-25.

DESCRIPTION

This distribution contains several SQL functions to be used with SQL::Statement:

ARGMAXNUM()
ARGMAXSTR()
ARGMINNUM()
ARGMINSTR()

These functions are not aggregate functions. They are added due to the lack of CASE statement as well as IF function in SQL::Statement. For example, this SQL statement:

SELECT CASE WHEN a > b THEN a ELSE b END FROM table

can be expressed with:

SELECT ARGMAXNUM(a, b) FROM table

To use a function from Perl script:

require SQL::Statement::Function::ByName::ARGMAXNUM;
$dbh->do(qq{CREATE FUNCTION ARGMAXNUM NAME "SQL::Statement::Function::ByName::ARGMAXNUM::SQL_FUNCTION_ARGMAXNUM"});

To use a function from fsql:

% fsql -F ARGMAXNUM --add-csv path/to/sometable.csv "SELECT ARGMAXNUM(col1,col2) FROM sometable ..."

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/SQL-Statement-Functions-ArgMinMax.

SOURCE

Source repository is at https://github.com/perlancar/perl-SQL-Statement-Functions-MinMax.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=SQL-Statement-Functions-ArgMinMax

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

SEE ALSO

SQL::Statement

App::fsql

AUTHOR

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by perlancar@cpan.org.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.