Solved

subquerys in Visual Fox Pro 2.6

Posted on 2011-03-25
6
680 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
Quiz: What Do These Organizations Have In Common?

Hint: Their teams ended up taking quizzes, too.

 

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month6 days, 9 hours left to enroll

634 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