Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
One to almost one
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00179045
Message ID:
00179108
Vues:
24
>
You'll get only 1 row this way I think. ... and if you specify the clientkey, you'll get some result: like group by Clients.Clientkey?

Have to go now. Nice week end.

Marc

What I did was:
>
>SELECT TOP 1 clients.*, locs.lockey
>FROM clients LEFT OUTER JOIN locs on clients.addr = locs.loc
>GROUP BY clientkey
>
>Don't know if it works yet because now it's babbling something about clientkey not being unique... Sigh...
>
>Thanks,
>
>-Michelle
>
>
>
>>This one withe full SQL I hope :)
>>
>>
>>Hi Michelle,
>>
>>
>>
>>This what helps says about this:
>>
>>Quote
>>
>>TOP nExpr [PERCENT]
>>
>>Specifies that the query result contains a specific number of rows or a percentage of rows in the query result. You must include an ORDER BY clause when you include the TOP clause. The ORDER BY clause specifies the columns on which the TOP clause determines the number of rows to include in the query result
>>
>>UnQuote
>>
>>See? Not only percent, but also a number of rows.
>>
>>the obvious way to use this is in a subquery.
>>
>>select * ;
>>from .your main table., .your address table. ;
>>where .AddressKeyInMain.=.AddressKeyInAddress. ;
>>and AddrssKeyInMain in (select AddressKeyInAddress top 1;
>>from .Your Address Table. ;
>>where .AddressKeyInMain.=.AddressKeyInAddress.)
>>
>>Hmm. I must admit it is less elegant than I thought, but it should work. Me? I would use 2 sqls. Divide et impera (divide an conquer) is the name of the game.
>>
>>Regards.
>>
>>
>>>Maybe I'm misunderstanding that... I thought that was to return the top n% of the matches. I need it to return every client.
>>>
>>>Thanks,
>>>
>>>-Michelle
>>>
>>>>Hi Michelle,
>>>>
>>>>I'd say you can use the Top clause that exists now in the Select SQL statement.
>>>>
>>>>Kind regards,
>>>>
>>>>Marc
>>>>
>>>>
>>>>>I have a clients table and a locations table. Each client has and address that is in the locations table. I want to join the clients table to the locations table so I can replace the address in the clients table with the key to that address in the locations table.
>>>>>
>>>>>For the most part, there is only one of each address in the locations table. But because I'm working with bad data, there might be more than one.
>>>>>
>>>>>Is there a join that will take one and only one of each client and match it up to the first address in locations that it finds, and doesn't make a second entry of the same client for the second address in locations?
>>>>>
>>>>>Thanks,
>>>>>
>>>>>-Michelle

If things have the tendency to go your way, do not worry. It won't last. Jules Renard.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform