QUESTION OF INSTRUCTION SQL (SELECT UNION)

General discussion forum about all databases other than SqlBase.
jlmunoz

QUESTION OF INSTRUCTION SQL (SELECT UNION)

Post by jlmunoz » 05 Jul 2010, 20:14

I HAVE a "Select-UNION". SELECT THE FIRST PART 10 RECORDS AND SELECTION PART 2 WORKS PERFECTLY IN TRAINING REGISTROS.ESTA SQLSERVER, BUT DOES NOT WORK WITH SALTBLPOPULATE. WHY DO NOT REGARD THE STATUS OF THE SECOND PART AND SELECT ALL.

I THINK THE PROBLEM IS WITH THE FIELDS OF SQLSERVER DATETIME WITH TEAM DEVELOPER

Select cempre,’1’ as orden,
count(distinct(nrutac))
from acaerdac
WHERE fcancela >= ‘xxxx-xx-xx’ and
fcancela < ‘xxxx-xx-xx’ and
(cedivi = 3
or cedivi = 6)
Group by cempre
union all
Select cempre,’2’ as orden,
count(distinct(nrutac))
from acaerdac
WHERE fcancela >= ‘xxxx-xx-xx’ and
fcancela < ‘xxxx-xx-xx’ and
cedivi = 4
Group by cempre
ORDER BY 2

FRBhote
India
Posts: 2203
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

Re: QUESTION OF INSTRUCTION SQL (SELECT UNION)

Post by FRBhote » 06 Jul 2010, 06:45

Have you installed the Sql Server service pack?

ThomasSchuele

Re: QUESTION OF INSTRUCTION SQL (SELECT UNION)

Post by ThomasSchuele » 06 Jul 2010, 08:09

Select cempre,’1’ as orden,count(distinct(nrutac))
from acaerdac
INTO :Column1,:Column2,:Column3
WHERE fcancela >= ‘xxxx-xx-xx’ and
fcancela < ‘xxxx-xx-xx’ and (cedivi = 3 or cedivi = 6)
Group by cempre
union all
Select cempre,’2’ as orden,count(distinct(nrutac))
from acaerdac
WHERE fcancela >= ‘xxxx-xx-xx’ and fcancela < ‘xxxx-xx-xx’ and cedivi = 4
Group by cempre
ORDER BY 2

Better use Into-Vars?
Best regards,
Thomas

Return to “General Discussion”

Who is online

Users browsing this forum: [Ccbot] and 1 guest