手上已经有一个汉字转拼音的函数fGetPy(),平时都是这么用的:select fgetpy("周") from dual;
现在我想要实现这样的功能:使用一条sql语句检索出拼音首字母符合指定值的记录,
形式如:select distinct username from userinfo where py ='z';(但是表中并没有‘py’这个字段)。
我试过这样的:select distinct username,fgetpy(username) as py from userinfo, dual ;
这样可以检索,但是select distinct username,fgetpy(username) as py from userinfo, dual where py='z';时就出错,提示:无‘py‘列。
这个可能是别名不能做检索条件的缘故,那么哪位大侠可以告诉我如何在不改变表结构的情况下使用一条语句实现功能。