>Yes, its for Sql Server and its working fine, thanks.
>
>But, another issue is recods displying repeatedly, And i solved using 'Distinct' command.
>
>Now i have one technical question, that if we issue a 'Distinct' to in front of a fieled it will
>eliminate the repeatation of only the particular field or it will effect the entire query result.
>
>Thanks a lot
>
>Regards
>Abdulla
In the form people use it mostly it'd return entire query, ie:
select distinct field1, field2 ...
Rows that match in its entirety would be eliminated to have duplicates.
There is another less used form of it used with aggregates. ie:
select Cust_id, cnt(distinct emp_id) from orders group by 1
Counts employees that made sales per customer (ie: If Justin and Laura are the only sales persons for customer ALFKI and ALFKI had 2 or more orders the result would be: ALFKI,2)
Your solution is not a good one. Recheck your tables. From original code it sounded table2 should only have one match per pincode. While it'd work with distinct result might not be the one intended.
Cetin