Solved

subquerys in Visual Fox Pro 2.6

Posted on 2011-03-25
6
668 Views
Last Modified: 2012-05-11

necesito generar una subconsulta para validar datos de una tabla en otra, la estructura que le estoy dando es la siguiente:

SELECT        
so.socodsoc,
so.soapelli + ' ' + so.sonombre AS datos,
so.solibele,
so.sosexo,
so.sotelefo,
 so.socelu,
(select ge.contrato from  geprevis ge WHERE  ge.codsoc=so.socodsoc)
FROM  
socios so;

estoy usando un dataset dentro del visual studio, para cargar los datos en mi gridcontrol, pero la consulta no da resultado, alguien tiene la solucion?
0
Comment
Question by:infogws
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 42

Expert Comment

by:pcelba
ID: 35217187
SELECT        
so.socodsoc,
so.soapelli + ' ' + so.sonombre AS datos,
so.solibele,
so.sosexo,
so.sotelefo,
so.socelu,
ge.contrato
FROM socios so
INNER JOIN geprevis ge ON ge.codsoc=so.socodsoc

Note the missing semicolon at the end. The whole query must be in one string with no line breaks.

Tenga en cuenta que falta el punto y coma al final. La consulta completa debe estar en una cadena sin saltos de línea.

0
 

Author Comment

by:infogws
ID: 35217230
Comprendo lo que me dices, ahora no puedo utilisar el INNER JOIN ya que cuando realize la consulta si un socio no esta dentro de la taba geprevis no me lo mostratra, lo que yo quiero lograr es mostrar a todos los socios y los que esten dentro de la tabla geprevis me muestre el dato que pongo dentro de la subconsulta, estube probando con UNION  pero sigo sin resultado alguno
0
 
LVL 42

Expert Comment

by:pcelba
ID: 35217315
SELECT        
so.socodsoc,
so.soapelli + ' ' + so.sonombre AS datos,
so.solibele,
so.sosexo,
so.sotelefo,
so.socelu,
ge.contrato
FROM socios so
LEFT JOIN geprevis ge ON ge.codsoc=so.socodsoc

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:infogws
ID: 35219069
Probe con la sentencia que me enviaste pero no resulta, tambien me olvide de agregar que la version de fox es la 2.6 ... y la estoy ejecutando desde un dataset en visual studio
0
 
LVL 42

Accepted Solution

by:
pcelba earned 500 total points
ID: 35220417
No sé, ¿cómo acceder a los datos DBF. Visual Studio puede consultar datos de FoxPro a través de VFP proveedor OLE DB que sabe izquierda se une.

Usted puede tratar de UNION en FoxPro 2.6:

SELECT        
so.socodsoc,
so.soapelli + ' ' + so.sonombre AS datos,
so.solibele,
so.sosexo,
so.sotelefo,
so.socelu,
ge.contrato
FROM socios so, geprevis ge
WHERE ge.codsoc=so.socodsoc
UNION ALL
SELECT        
so2.socodsoc,
so2.soapelli + ' ' + so.sonombre AS datos,
so2.solibele,
so2.sosexo,
so2.sotelefo,
so2.socelu,
SPACE(10)
FROM socios so2
WHERE so.socodsoc NOT IN (SELECT codsoc FROM geprevis)

SPACE(10)  must be replaced by appropriate "empty" value.
0
 

Author Closing Comment

by:infogws
ID: 35375411
Didnt solve the problem, but he sure wanted to help.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question