Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
>>>>I am trying to select distinct records from a sql statement in vfp.
>>>>But the distinct keyword only works on the whole record.
>>>>My question is there a way to limit records by a distinct column in vfp6.0? Thanks Eric
>>>
>>>The DISTINCT predicate does work on columns. Can you post the SQL statement that is giving you trouble?
>>
>>I have a persons table and a address table. The address table can have multiple
>>records for a particular person. The code goes as follows:
>>
>>SELECT DISTINCT PERSONS.ID, ADDRESS.STREET, ADDRESS.CITY, ADDRESS.STATE,; ADDRESS.ZIP FROM PERSONS, ADDRESS ;
>>WHERE PERSONS.ID = ADDRESS.ID ;
>>INTO TABLE Q1
>
>Sorry, but I was incorrect about the DISTINCT predicate, as you probably already know :). Are you trying to get just one address for each person? Or are you trying to get all people with more than one address?
I am trying just to grab a person with a address, but I get several records for a person with several address records. I generally have to create a index on the id unique and that works fine.
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement