This topic is locked

search on alias field

11/4/2003 11:29:44 AM
ASPRunnerPro General questions
wingchan author

i have this sql
SELECT

a.[id],

b.[name] as mall_name,

a.[name] as tenant_name,

a.[location]

From [dbo].[tb_tenant] a

inner join [dbo].[tb_mall] b

on a.[mall_id]=b.[id]
and have activate the search on "tenant_name", but when i tried to do the search on this field, it returns error
-2147217900

SELECT a.[id], b.[name] as mall_name, a.[name] as tenant_name, a.[location] From [dbo].[tb_tenant] a inner join [dbo].[tb_mall] b on a.[mall_id]=b.[id] where [tenant_name] like '%A%'
it seems it uses the [tenant_name] as the field name to do the "where" clause, so just wonder whether the alias fields can be searched.. otherwise how can I complete this task, many thanks.
Urgent, please help.
-Wing

Sergey Kornilov admin 11/9/2003

Wing,
here is the SQL query that will work:

SELECT a.[id], b.[name] as mall_name, a.[name] as tenant_name, a.[location] From [dbo].[tb_tenant] a inner join [dbo].[tb_mall] b on a.[mall_id]=b.[id] where a.[name] like '%A%'


I would recommend to change field name in the combobox on the list page manually.
Best regards,

Sergey Kornilov