mcolson (mcolson1590 (AT) gmail (DOT) com) writes:
Quote:
I'm trying to merge to records. All of the fields are the same except
for dbo.MaterialProducedActualEpa.EpaName. I'm able to use a 2nd
field to determine which one I want. Is it possible to show both of
them in 1 record? The following try may help to understand what I'm
trying to achieve. |
I'm afraid that I feel quite clueless. You have two tables,
MaterialProducedActualEpa and ResourceActualEpa. You join them over
GenealogyId. Is that column a primary key in both tables? No, that
does not seem likely, given your WHERE condition.
I don't really know you mean with show "both of them in one record".
Do you want to display rows from both tables as one row in the output?
Quote:
With Case Statements
NULL NULL FNL XC20 MILLENNIUM NULL NULL NULL NULL
NULL NULL
PartDescription I/O MILLENNIUM 20 LITER NULL 127927 Leak1
NO LEAK
2010-04-19 13:52:56.983 Inner Mass Spec. 20100419135242
Without
PartDescription I/O MILLENNIUM 20 LITER 127927 Leak1 NO
LEAK
2010-04-19 13:52:56.983 Inner Mass Spec. 20100419135242
PartDescription I/O MILLENNIUM 20 LITER 127927 Leak1 NO
LEAK
2010-04-19 13:52:56.983 Inner Mass Spec. 20100419135242 |
Since news tends to wrap lines at a width of 80 characters, this is
difficult to read and understand. Even less do I know where the output
"without" comes from. Or what result you really want.
In short, I think you need to explain a little more in detail, what
you are trying to achieve.
And, by the way, there are no CASE statements in SQL, but well a
CASE expression.
--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se
Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinf...ons/books.mspx