之前给朋友写了个问卷调查,用题号排序的,后来呢出现一个问题就是说排序的时候排出来是 1,10,11,2这样的。
select * from wenti where id = '"&id&"' order by wentith
后来呢改成
select * from wenti where id = '"&id&"' order by cast(wentith as int)
问题就解决了
然后我想依法炮制在联合查询中,
SELECT DISTINCT * from wenti as a,wentixx as b where a.id='"&id&"' and a.wentidm=b.wentidm and a.wentith<>'' and b.wtxxxh<>'' order by cast(a.wtth as int)
结果就是提示
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC SQL Server Driver][SQL Server]如果指定了 SELECT DISTINCT,那么 ORDER BY 子句中的项就必须出现在选择列表中。
很疑虑,想问下各位达人这种情况应该如何处理:)