Solved

subquerys in Visual Fox Pro 2.6

Posted on 2011-03-25
6
623 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
  • 3
  • 3
6 Comments
 
LVL 41

Expert Comment

by:pcelba
Comment Utility
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
Comment Utility
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 41

Expert Comment

by:pcelba
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:infogws
Comment Utility
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 41

Accepted Solution

by:
pcelba earned 500 total points
Comment Utility
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
Comment Utility
Didnt solve the problem, but he sure wanted to help.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Vb.Net Menu 1 21
Total in textboxes 9 35
.Net Web Site Password specs 2 20
Visual Studio 2005 text editor 10 18
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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

743 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now