Hint (try understanding the following query):
Select Comp_ID, Comp_Name
>From tbl_Company AS C
INNER JOIN (
Select Comp_ID
From tbl_CompanyAddress
GROUP BY Comp_ID
HAVING Count(Comp_ID) > 2
) AS MoreThan2Address ON C.Comp_ID =
MoreThan2Address.Comp_ID
Where Comp_Type = 'Private Limited'
On Mon, Jun 22, 2009 at 3:28 PM, Jeena Ajiesh <[email protected]> wrote:
> Hi all,
> While i was trying to select some records from db it show 1 error,
>
> *An aggregate may not appear in the WHERE clause unless it is in a
> subquery contained in a HAVING clause or a select list, and the column being
> aggregated is an outer reference.
> *
> How can i solve this problem?
>
> My sql query is as follows
> **
>
> Dim emira, siz, price, rentprice As String
>
> emira = emi.SelectedItem.Text (Place)
>
> siz = size.SelectedItem.Text (Eg: 0,1, 2, 3)
>
> Dim strsql As String
>
> strsql =
> "Select distinct sno,companyname,mobileno from Real where Emi='" & emira &
> "' and count('" & siz & "')>0 and '" & siz & "'price<='" & price & "' and
> '" & siz & "'price>'" & rentprice & "' and area='" &
> area.SelectedItem.Text & "'"
> Can anyone help me to modify this query?
>
> --
> ****************
> Thanks & Regards,
> Jeena Ajiesh
> Email: [email protected]
> [email protected]
>
>