Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

subquerys in Visual Fox Pro 2.6

Posted on 2011-03-25
6
Medium Priority
?
689 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 43

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 43

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 43

Accepted Solution

by:
pcelba earned 1500 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
Suggested Courses

715 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