[Gambas-user] SQL SELECT DISTINCT

Ron Onstenk ronstk at ...239...
Sat Jul 22 23:23:02 CEST 2006


On Friday 21 July 2006 05:49, George Neusse wrote:
> Hello,
> 
> I have been playing around with Gambas for a few versions.  I think it is a
> great tool.
> 
> But.....
> 
> I am having some trouble with the DB object.
> 
> I want to query a table for a field.  but i want that "DISTINCT" elements
> returned.
> What I see in the docs only seems to want to deal with a "WHERE" caluse.
> There are things that can be done in the "SELECT" that cant be done in the
> "WHERE",
> How do I submit a strait SQL statement and get the returned result set.
> It seems this would also be needed for stored procedures.
> 
> 
> Am I missing something here?
> 

dim hResult as Result
dim hConn as Connection
dim sql as string
  sql="select distinct tbl_id as membernumber, name from members where ....bla bla"
  hResult =hConn.exec(sql)

  'do with hResult you want

This works great here with MySQL.

One note:
The ampersand can trigger the internal substitute for parameterised queries.
for the remaining part it should act as direct request to the sql server.

Ron






More information about the User mailing list