OT : help needed with a mySQL request

Devin Asay devin_asay at byu.edu
Fri Nov 22 12:30:27 EST 2013


On Nov 22, 2013, at 10:16 AM, <jbv at souslelogo.com>
 wrote:

> John,
> 
> Thank you so much : I just tested the request you sent and compared it
> with the results I got with several successive requests and everything
> is consistent...
> 
> If I may, I have one last question though :
> what if I want, in the same single request, to output the number of
> distinct names, instead of the full list of entries with all columns ?
> In your example the output should be "1".
> I tried
>   SELECT COUNT(DISTINCT name)
> at the beginning of the request, but the result was empty…


Again, not tested, but it might need an embedded query:

  SELECT COUNT(SELECT DISTINCT name from foo)

Me, I usually take the coward's way out:

   put revDataFromQuery(,,connid, "SELECT DISTINCT name FROM foo") into tNames
   put the number of lines in tNames into tNameCount

:-)

Devin


Devin Asay
Learn to code with LiveCode University
http://university.livecode.com





More information about the use-livecode mailing list