Hello,
I'm struggling with another statement so that it works unchanged on
MySQL 5.1 and H2 1.3.164:
MySQL:
SELECT DISTINCT p.s_id,p.edition FROM publication p => OK
SELECT COUNT(DISTINCT p.s_id,p.edition) FROM publication p => OK
H2:
SELECT DISTINCT p.s_id,p.edition FROM publication p => OK
SELECT COUNT(DISTINCT p.s_id,p.edition) FROM publication p => Syntax
error
but SELECT COUNT(DISTINCT p.s_id) FROM publication p is ok.
What do you think?
For the moment, I've found a workaround with a user defined CONCAT_WS
function (which exists in MySQL):
SELECT COUNT(DISTINCT(CONCAT_WS('-', CAST(p.s_id AS CHAR),
CAST(p.edition AS CHAR)))) FROM publication p
with
CREATE ALIAS CONCAT_WS FOR "H2Functions.concatWS";
public class H2Functions {
public static String concatWS(String separator, String... args) {
return com.google.common.base.Joiner.on(separator).join(args);
}
}
not very nice though.
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en.