Jump to content

sql question


Recommended Posts

Hi

how i cand get the biggest value ( is a decimal field) from a database?

i use mysql.au3

i try something like this

$ord = _Query($sql,"SELECT crt, MAX(my_field) FROM table GROUP BY obs")

With $ord

$test = .Fields("my_field").value

filewrite ("c:\order.txt", $test)

While NOT .EOF

.MoveNext

WEnd

EndWith

but don`t work

Link to comment
Share on other sites

  • 2 weeks later...

Hi

how i cand get the biggest value ( is a decimal field) from a database?

i use mysql.au3

i try something like this

$ord = _Query($sql,"SELECT crt, MAX(my_field) FROM table GROUP BY obs")

With $ord

$test = .Fields("my_field").value

filewrite ("c:\order.txt", $test)

While NOT .EOF

.MoveNext

WEnd

EndWith

but don`t work

1) use crt in GROUP BY

2) read value inside While loop (and not outside)

3) I'm not sure if .Fields ("my_field") is corrects, test real names of columns

Something like this (not tested):

$ord = _Query ($sql, "SELECT crt, MAX(my_field) FROM table GROUP BY crt")
$test = ''

With $ord
    While Not .EOF
        $test &= .Fields ("my_field").value
        .MoveNext
    WEnd
EndWith

FileWrite("c:\order.txt", $test)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...