× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.





How I do it?


Joe Pluta escribió:
pepitovadecurt wrote:
But when include other table,

SELECT VC00.VCNCV, TM00.TMNOML,VC00.VCDTCV, VC00.VCCDIV, case when
VCESPC='S' then 'P' end FROM VC00, TM00, VC00E WHERE
VC00.VCESTA='A' and VC00.VCCCLI=TMCTER and VC00.VCCDIV='USD' ORDER
BY VC00.VCNCV

The querry returns a few lines with the same information.

RESULT:

Nº CV Nombre interno Im.total CV divisas C.DivisaExpresiónCASE
30.655 xxxxxxxxxxxxxxxx ,00 USD -
30.655 xxxxxxxxxxxxxxxx ,00 USD -
30.655 xxxxxxxxxxxxxxxx ,00 USD -
30.655 xxxxxxxxxxxxxxxx ,00 USD -
30.655 xxxxxxxxxxxxxxxx ,00 USD -
30.655 xxxxxxxxxxxxxxxx ,00 USD P
30.655 xxxxxxxxxxxxxxxx ,00 USD P
30.655 xxxxxxxxxxxxxxxx ,00 USD P
30.655 xxxxxxxxxxxxxxxx ,00 USD -

The nulls are because your CASE statement has no ELSE. Compare the CASE statement in this to your earlier statement where you had (else ' ') as part of the statement.

As others have pointed out, the multiple lines result from not correlating the files. You have to specify how the keys in the primary file are used to get records from the other files. If not, you end up with huge cross-products (I've always hated this default behavior, but that's the way relational databases work).

My suggestion is to first get your query working *without* the CASE statement, which will make sure you get the right records in the result set. Then, add your CASE statements as needed.

Joe



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.