November 6, 2017 at 8:41 am
Hi
I am displaying Distinct Location Code from a table . It has some Blank values. In a report i want Value of Blank Location Code should also get displayed. I am working on Matrix report.
Below Sql is not working for Blank Location Code.
Select '' as Code from [Test $G_L Entry]
Union
Select Distinct[Location Code] as Code from [Test $G_L Entry]
Thanks
November 6, 2017 at 8:54 am
I realise that there is a language barrier here, but your statement doesn't really make sense. Cold you try rewording your statement into a question please, and try to be clearer about your goals and problems?
Thanks.
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
November 6, 2017 at 9:38 am
The "from [Test $G_L Entry]" is is not necessary here:Select '' as Code from [Test $G_L Entry]
You could do this:Select '' as Code
union
Select distinct [Location Code] as Code from [Test $G_L Entry];
or this:Select '' as Code
union all
Select Distinct[Location Code] as Code from [Test $G_L Entry];
Note that UNION (not UNION ALL) forces a unique result set. DISTINCT does too. That means that you don't need both UNION and DISTINCT.
-- Itzik Ben-Gan 2001
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy