Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Retrieving data from multiple tables
Message
From
20/09/2005 06:50:20
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
20/09/2005 06:39:48
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows 2000 SP4
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01051149
Message ID:
01051184
Views:
8
>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
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform