/bundles/itninjaweb/img/Breadcrumb_cap_w.png
I am trying to use aggregate function in Installer database query. Something like,

SELECT MAX(`DiskId`) FROM `Media`

but it is failing miserably. Help needed!!!

[font="verdana, geneva, helvetica"]
0 Comments   [ - ] Hide Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
Answer this question or Comment on this question for clarity

Answers

0
you should realise that an MSI only supports a subset of the full SQL syntax when querying it. I don't actually know by heart what you can and cannot use, but I'm guessing MAX is one of the unsupported ones...


PJ
Answered 02/23/2010 by: pjgeutjens
Red Belt

Please log in to comment
0
http://msdn.microsoft.com/en-us/library/aa372021%28VS.85%29.aspx

I'm determined to make this Google thing catch on, you know. You people won't stop me!
Answered 02/23/2010 by: VBScab
Red Belt

Please log in to comment
0
Hey VBScab, I read that but I thought there could be some undocumented stuff .... :-)
Answered 02/23/2010 by: milindsm
Blue Belt

Please log in to comment
0
If there was, the very fact that it was undocumented should spell "AVOID" in foot-high letters, no?
Answered 02/23/2010 by: VBScab
Red Belt

Please log in to comment
1
....I suppose a crude method would be something like:

Dim highestDiskId : highestDiskId = 0
Dim sql : sql = "SELECT `DiskId` FROM `Media` ORDER BY `DiskId`"
Set mediaView= Session.Database.OpenView(sql)
mediaView.Execute
Set mediaRecord = mediaView.Fetch
While Not mediaRecord Is Nothing
highestDiskId = mediaRecord.StringData(1)
Set mediaRecord = mediaView.Fetch
Wend
MsgBox highestDiskId


....the media table is sorted by default on the DiskId column, but other tables/fields probably wont be, and hence you'd keep the ORDER BY clause.....
Answered 02/23/2010 by: captain_planet
Fifth Degree Brown Belt

Please log in to comment
0
Thanks captain_planet .....yes.. that's what I did... just looking for inbuilt mechanism....!!! :P
Answered 02/25/2010 by: milindsm
Blue Belt

Please log in to comment