/build/static/layout/Breadcrumb_cap_w.png

Aggregate Functions in Installer SQL

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   [ + ] Show comments

Answers (6)

Posted by: captain_planet 14 years ago
Black Belt
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.....
Posted by: pjgeutjens 14 years ago
Red Belt
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
Posted by: anonymous_9363 14 years ago
Red Belt
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!
Posted by: milindsm 14 years ago
Blue Belt
0
Hey VBScab, I read that but I thought there could be some undocumented stuff .... :-)
Posted by: anonymous_9363 14 years ago
Red Belt
0
If there was, the very fact that it was undocumented should spell "AVOID" in foot-high letters, no?
Posted by: milindsm 14 years ago
Blue Belt
0
Thanks captain_planet .....yes.. that's what I did... just looking for inbuilt mechanism....!!! :P
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ