-----Original Message-----
From: sqlite-dev [mailto:sqlite-dev-boun...@mailinglists.sqlite.org]
On Behalf Of Steve Leonard
Sent: Thursday, 6 December, 2018 18:29
To: sqlite-...@mailinglists.sqlite.org
Subject: [sqlite-dev] using COUNT(*) in sql from a delphi program

I have a very basic query like this

select state, count(*) from customers
group by state

I am using a Delphi program which displays the data in a dbgrid.

The problem is the count(*) displays as "WIDEMEMO".

I have revised the select statement adding "as mycount" like this:

select state, count(*) as mycount from customers and this runs fine
using other database.

This was the correct solution to the first problem.

With SQLITE it has a problem with the field mycount, and when I go
into
the fields editor and add mycount as a new field

of type aggregate or calculated I have different problems.

That field, to the Delphi DB components, is just a normal field, not a calculated or aggregate field, but it can't be updated (which may cause the confusion) - which makes me think you are using some weird connection object, query object, or setup.

Eventually I found a combination of entries into the "new field"
screen
that works, but the mycount field is blank.

My attempts to use the delphi "fieldbyname('mycount') do not work.
Does
anyone have a sample Delphi program using SQLITE that displays the
value
of "count(*)"?

Here is a sample Delphi program using SQLite: www.sqlitespeed.com - but I assume you would rather like a sample program using the exact DB objects and connections that you are using (which could be one to many of many), so if you share the exact objects plus delphi version, we can surely assist with samples.

Thank you.

Steve

Pleasure Steve - This is however a Delphi question and not really an SQLite question, so might be better suited on a Delphi forum - however, there's a few Delphi devs here and we'd be glad to help without spamming the list too much.

Cheers!
Ryan

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to