
Moderator: Gurus
ZvezdanD wrote:One more thing which I really missed in Jet: you could use aliases defined in SELECT part into WHERE/GROUP BY/ORDER BY expressions, e.g. SELECT Count(Songs.Album) AS CountField FROM Songs GROUP BY CountField.
SELECT Album AS Alb, Count(Songs.Album)
FROM Songs
GROUP BY AlbSELECT Count(Songs.Album) AS CountField FROM Songs GROUP BY CountFieldSELECT Count(Songs.Album) AS CountField FROM Songs GROUP BY Count(Songs.Album)ZvezdanD wrote:However, I really hate that it don't allow several LIMIT statements in one complex query (with sub-queries), even more than its lack of functions
Bex wrote:This is actually supported!
SELECT Count(Songs.Album) AS CountField FROM Songs ORDER BY CountFieldBex wrote:I've used it successfully with one level subquery. Do you have any example which doesn't work?
The limit is applied to the entire query not to the individual SELECT statement to which it is attached.
Bex wrote:The statement ... Is only applicable to compound queries, i.e. use of UNION, UNION ALL, INTERSECT, or EXCEPT
Bex wrote:Limit in Inlines/Subqueries works just fine!
acondios wrote:select Artist from Artists Order By Artist collate nocase desc
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SQL=System.Data.SQLite;
namespace MediaMonkeyDB
{
class Program
{
static void Main(string[] args)
{
List<Int32> listIDGenresToDelete = new List<int> { 17, 67, 214, ...};
SQL.SQLiteConnection cn = new System.Data.SQLite.SQLiteConnection(@"data source=C:\Temp\MediaMonkey\MM.DB");
cn.Open();
SQL.SQLiteCommand cmd = new System.Data.SQLite.SQLiteCommand(cn);
try
{
foreach (Int32 IDGenre in listIDGenresToDelete)
{
cmd.CommandText = string.Format("DELETE FROM [GenresSongs] WHERE [IDGenre] = {0};", IDGenre);
cmd.ExecuteNonQuery();
}
Console.WriteLine("Finished");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
finally
{
Console.ReadLine();
}
}
/// <summary>
/// User-defined collating sequence.
/// </summary>
[SQL.SQLiteFunction(Name = "IUNICODE", FuncType = SQL.FunctionType.Collation)]
class IUNICODE : SQL.SQLiteFunction
{
public override int Compare(string param1, string param2)
{
return String.Compare(param1.ToLower(), param2.ToLower(), true);
}
}
}
}
Users browsing this forum: No registered users and 8 guests