{"action":"created","issue":{"url":"https://api.github.com/repos/agershun/alasql/issues/411","labels_url":"https://api.github.com/repos/agershun/alasql/issues/411/labels{/name}","comments_url":"https://api.github.com/repos/agershun/alasql/issues/411/comments","events_url":"https://api.github.com/repos/agershun/alasql/issues/411/events","html_url":"https://github.com/agershun/alasql/issues/411","id":106118233,"number":411,"title":"MAX/MIN function not working for words","user":{"login":"trittberg","id":8638291,"avatar_url":"https://avatars.githubusercontent.com/u/8638291?v=3","gravatar_id":"","url":"https://api.github.com/users/trittberg","html_url":"https://github.com/trittberg","followers_url":"https://api.github.com/users/trittberg/followers","following_url":"https://api.github.com/users/trittberg/following{/other_user}","gists_url":"https://api.github.com/users/trittberg/gists{/gist_id}","starred_url":"https://api.github.com/users/trittberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trittberg/subscriptions","organizations_url":"https://api.github.com/users/trittberg/orgs","repos_url":"https://api.github.com/users/trittberg/repos","events_url":"https://api.github.com/users/trittberg/events{/privacy}","received_events_url":"https://api.github.com/users/trittberg/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/agershun/alasql/labels/for%20discussion","name":"for discussion","color":"fbca04"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-09-12T01:08:13Z","updated_at":"2015-09-18T12:06:28Z","closed_at":null,"body":"Apparently, using JSON table data, and aggregating the entire table into one record (no GROUP BY):\r\nthe SUM function works fine, but\r\nthe MAX/MIN functions return \"undefined\"\r\nand the GREATEST/LEAST functions return 0.\r\n\r\nHere is a sample of the data I use:\r\n```\r\n[ {field1: value1, field2:value2} ],\r\n[ {fieldA: valueA, fieldB: valueB} ]\r\n```\r\n\r\nAm I doing something wrong or are the functions incomplete?\r\n\r\nThanks,\r\nTimm"},"comment":{"url":"https://api.github.com/repos/agershun/alasql/issues/comments/141430639","html_url":"https://github.com/agershun/alasql/issues/411#issuecomment-141430639","issue_url":"https://api.github.com/repos/agershun/alasql/issues/411","id":141430639,"user":{"login":"mathiasrw","id":1063454,"avatar_url":"https://avatars.githubusercontent.com/u/1063454?v=3","gravatar_id":"","url":"https://api.github.com/users/mathiasrw","html_url":"https://github.com/mathiasrw","followers_url":"https://api.github.com/users/mathiasrw/followers","following_url":"https://api.github.com/users/mathiasrw/following{/other_user}","gists_url":"https://api.github.com/users/mathiasrw/gists{/gist_id}","starred_url":"https://api.github.com/users/mathiasrw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mathiasrw/subscriptions","organizations_url":"https://api.github.com/users/mathiasrw/orgs","repos_url":"https://api.github.com/users/mathiasrw/repos","events_url":"https://api.github.com/users/mathiasrw/events{/privacy}","received_events_url":"https://api.github.com/users/mathiasrw/received_events","type":"User","site_admin":false},"created_at":"2015-09-18T12:06:28Z","updated_at":"2015-09-18T12:06:28Z","body":"\r\n\r\nGood to know you could use the answer... AlaSQL also supports the MSSQL notation:\r\n\r\n```\r\nsql = \"SELECT TOP 1 text FROM ? ORDER BY text DESC\"\r\ndata = [{\"text\":\"abc\",\"value\":\"ConfigPanel\"},{\"text\":\"def\",\"value\":\"ConfigPanelEdit\"}]\r\nconsole.log(JSON.stringify(alasql(sql, [data])))\r\n// [{\"text\":\"def\"}]\r\n```"}}