Showing posts with label track. Show all posts
Showing posts with label track. Show all posts

Monday, March 26, 2012

IF Condition in Join?

Dear Group

I'd be grateful if you can send me on the right track in achieving this.

I have three tables A,B,C outlined as follows:

Table: A
Field: RowID
Field: EntityID
Field: TypeIdentifier

Table: B
Field: RowID
Field: Name

Table: C
Field: RowID
Field: Name

Let's assume I've the following records:

Table A:
1,1,0
2,1,1

Table B:
1,Smith

Table C:
1,XYZCorporation

The table joins are as follows:

A.EntityID = B.RowID
A.EntityID = C.RowID

I would like to select all records from Table A and display the Names from
either Table B or Table C, depending on the Field TypeIdentifier.
E.g.: SELECT Name FROM A JOIN B ON (A.EntityID = B.RowID) JOIN C ON
(A.EntityID = C.RowID) IF TypeIdentifier = 0 SELECT Name FROM B IF
TypeIdentifier = 1 SELECT Name FROM C

Resultset:

Smith
XYZCorporation

Is this somehow possible?

Thanks very much for your time & efforts!

MartinSELECT COALESCE(B.name,C.name) AS name
FROM A
LEFT JOIN B
ON A.entityid = B.rowid
AND A.typeidentifier = 1
LEFT JOIN C
ON A.entityid = C.rowid
AND A.typeidentifier = 0

--
David Portas
SQL Server MVP
--|||Thanks very much David!

"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> wrote in message
news:X4GdnRjemKI4mOndRVn-uA@.giganews.com...|||In the past, I have done something like this:

LEFT JOIN B ON A.entityid = B.rowid
LEFT JOIN C ON A.entityid = C.rowid"

with a Case statement in the select. Your version
is much nicer, thanks.

Bill

David Portas wrote:

> SELECT COALESCE(B.name,C.name) AS name
> FROM A
> LEFT JOIN B
> ON A.entityid = B.rowid
> AND A.typeidentifier = 1
> LEFT JOIN C
> ON A.entityid = C.rowid
> AND A.typeidentifier = 0

Friday, March 23, 2012

IE 7.0.5335.5 Beta 2 and SSRS 2000

Hi,
I'm trying to track and issue with IE 7 and reporting services.
First off, the report export to Excel works fine using IE 6
In IE 7 when I initially generate the report from a link in our website, the
report comes up correctly, but when I attempt to export that report to xls,
PDF, TIFF, HTML, etc I get an error that says:
"Internet Explorer cannon download Format=EXCEL from 192.168.0.250.
Internet Explorer was unable to open this Internet Site. The requested site
is either unavailable or cannot be found. Please try again later."
The site and format that it is trying to download is correct, but the
Certificate on the site is not working right (Known issue on our end). I
have added this site to the "Trusted Sites" under Internet Explorer"
Security.
Does anyone have a clue where this could come from?
Thanks
TrentAre you using SSL?
I had the same problem and found this topic which fixed my problem :
http://groups.google.co.nz/group/microsoft.public.sqlserver.reportingsvcs/browse_thread/thread/739f695f20237190/199c56a3165f6735?q=https&rnum=2#199c56a3165f6735|||That fixed it! Thank you for your response.
FYI - Solution is to uncheck "Do not save encrypted pages to disk"
This may be a long term security issue, but that is for another discussion.
Thanks again,
TTU
"CPNZ" wrote:
> Are you using SSL?
> I had the same problem and found this topic which fixed my problem :
> http://groups.google.co.nz/group/microsoft.public.sqlserver.reportingsvcs/browse_thread/thread/739f695f20237190/199c56a3165f6735?q=https&rnum=2#199c56a3165f6735
>sql