Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
marxeil
Starting Member
4 Posts |
Posted - 2009-01-02 : 10:19:16
|
I am having problems with this query:I have these 2 tables:MESSAGE_ELEMENTS:ELEMENT_PKELEMENT_NAMEMESSAGE_TYPESCHEMA_ELEMENTS:SCHEMAELEMENT_PK (this is FK from ELEMENTS)SUPPORTThe first table stores a list of elements in message types (each message type is made of a list of elements).The second table stores which fields in a message type are valid in a particular schema. What I want is to get a list of elements for a message type and display the support details for a particular schema: I tried something like this:SELECT MESSAGE_ELEMENTS.*FROM MESSAGE_ELEMENTSLEFT JOIN(SELECT SCHEMA_ELEMENTS.*, RESULT.SUPPORTFROM SCHEMA_ELEMENTSWHERE SCHEMA_ELEMENTS.SCHEMA_NAME = [schema name] AS RESULT)ONMESSAGE_ELEMENTS.ELEMENT_PK = RESULT.ELEMENT_PKWHERE MESSAGE_ELEMENTS.MESSAGE_TYPE = [message type]I tried all kind of variations on this and always get errors or wrong results.What am I doing wrong?Thanks |
|
|
|
|