As a last resort, I imagine one could query the table in the database directly using SQL. How do I find the names of the database, table and columns
Thanks,
Markus
As far as I know, there is no way to do a COUNT(*) in an SPQuery. You could perform your query in code, and only return the number of items, like:
Dim myList as SPList = SPContext.Current.Web.Lists("My List Name")
Dim myQuery as new SPQuery
myQuery.Query = "<Where>(Your filter here)</Where>"
Dim myItems as SPListItemCollection = myList.GetItems(myQuery)
Return myItems.Count
Altough I suspect that's not really how you want to do it.
As for querying the database directly, this is possible but I'm not sure if it's a good or bad thing to do so. The place to look is the "UserData" view in your "WSS_Content" database. To find out wich fields (they are named int1, int2, int3 etc.) contains the data you're interested in, look in the "tp_fields" field in the view "Lists". This field contains xml with the mappings between list fields and database fields.
One more thing to consider is that if you have many fields in your list, there is a change that one item will be split over several rows in the database.
/Bill.
This is strange, There should be some way by which we should be able to fire aggregate queries via view fields passed to GetListItems. I was going through the sdk, it mentions elements like <Aggregation> but it didnt worked for me. Query field has an options of specifying <GroupBy> so Aggregations should be possible. (the problem is that the SDK does not have a working example for performing aggregations via Lists.GetListItems)
It would be really bad from MS side if they do not provide aggregation queries via web services