Solved

subquerys in Visual Fox Pro 2.6

Posted on 2011-03-25
6
638 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
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 41

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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

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 41

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB6 Compile Compatibility Issue 4 87
VB.Net - CSV to Oracle table 4 51
Exit the loop 4 31
Pagebreak issue while printing the aspx page 3 11
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

929 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

7 Experts available now in Live!

Get 1:1 Help Now