SQL Help

prothero at earthlearningsolutions.org prothero at earthlearningsolutions.org
Fri Jun 1 23:01:30 EDT 2018


I’m thinking something like:

Select max(“iStoreGrp”) from “valveFlowsA” where (“valveNum”=n1 AND “meterNum”=n2)

Then I have to sort out how to put the statement in a string that can be sent to php.

Does this seem reasonable? I’ll find out tomorrow.

Best,
Bill

William Prothero
http://earthlearningsolutions.org

> On Jun 1, 2018, at 7:49 PM, prothero--- via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> Tnx for the input, folks. Yes, I want all of the columns. I could specify them each, because there are not many of them, but ......
> 
> I’m done for the evening, and will try your suggestions first thing in the morning. 
> 
> Best,
> Bill
> 
> William Prothero
> http://earthlearningsolutions.org
> 
>> On Jun 1, 2018, at 7:45 PM, Bob Sneidar via use-livecode <use-livecode at lists.runrev.com> wrote:
>> 
>> He wants all the columns I think. I suspect he will need a join on the same table. I'm too intoxicated to think about this, but I've done it before. Doesn't group by require that the columns be included in the select clause? 
>> 
>> Bob S
>> 
>> 
>>> On Jun 1, 2018, at 17:43 , Paul Dupuis via use-livecode <use-livecode at lists.runrev.com> wrote:
>>> 
>>> Not tested, but:
>>> 
>>> SELECT max(iStoreGrp) FROM valveFlowsA WHERE meterNum =1 AND valveNum =3
>>> GROUP BY meternum, valvenum, iStoreGrp
>>> 
>>> If my memory as I am falling asleep for the night serves me right.
>>> 
>>> 
>>> 
>>>> On 6/1/2018 8:31 PM, William Prothero via use-livecode wrote:
>>>> Folks:
>>>> Maybe someone can answer this easily and save me some hair pulling. I know it’s google-able, but I’ve tried and know it’s going to be a trudge to get the right format.
>>>> 
>>>> I want to make a query to a mySQL db that:
>>>> The table is named: “valveFlowsA”
>>>> I want the query to return the row with the maximum of a column named “iStoreGrp” when
>>>> columns named “meterNum” and “valveNum” are specified. So, with meterNum =1 and
>>>> valveNum =3, I would get the row for the maximum value of “iStoreGrp”.
>>>> 
>>>> All of these columns are integers.
>>>> 
>>>> If anybody has this query in their quiver of tools, please let me know.
>>>> Thanks!
>>>> 
>>>> Bill
>>>> 
>>>> William A. Prothero
>>>> http://earthlearningsolutions.org
>>>> 
>>>> _______________________________________________
>>>> use-livecode mailing list
>>>> use-livecode at lists.runrev.com
>>>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>> 
>>> 
>>> 
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the Use-livecode mailing list