Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Hi,
I need help with the Select-SQL statement.
I have a table, TAbleA from on which I execute a select query to retrieve all records that satisfy a certain criteria into a cursor CsrA.
Now I need to retrieve all records from TableA for which
- CsrA.fieldA = TableB.fieldA and
- TableB.fieldB = '101'
If I do a inner join on these tables, I get all records from cursor CsrA that meet this criteria, but records from csrA are repeated for every match found in TableB.
TableA and TableB have different structures. What I am trying to do is fetch all the records that meet the search criteria but having fieldB='101' and I do not have a fieldB in TableA.
What would be the best way to retrive all records only from cursorA for which TableB.fieldB='101'?
Select distinct csrA.* from csrA inner join TableB on ;
csrA.fieldA = TableB.fieldA ;
where TableB.fieldB='101'
would this query be the quickest way to achieve this?
Thank you.
Ria
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