August 19, 2009 at 6:12 am
I am using SSMS to create Views of data.
When you add a new field, it only returns records which have data assigned to those fields.
How do you include records whether they have data assigned to all fields or not?
For example, from the data below, only Joe and Amy would return in a View consisting
of NAME, ADDRESS, SOURCE, DESTINATION, as they have
entries in the 4 named fields.
Is there a way to show James and Mark too?
NAMEADDRESS SOURCE DESTINATION
JoeBloggs Home Office
AmyBlack Away Office
JamesGrey Holiday
MarkBlaine Home
Regards,
Gillian
August 24, 2009 at 5:21 pm
I might be over simplifying this, but why can't you do
SELECT
Col1,Col2,Col3,Col4
FROM YourTable
?
Greg
_________________________________________________________________________________________________
The glass is at one half capacity: nothing more, nothing less.
August 25, 2009 at 8:07 am
Are you joining to multiple tables? If so you can use outer join (right or left) to select from the table where there might not be data.
August 27, 2009 at 3:18 am
Thankyou for taking the time to reply.
I have tried OUTER JOIN and can get it to work to an extent.
Unfortunately the list I am returning has different groups, say 1,2,3,4 and NULL.
I want to return results for 1 and NULL, but when I filter for 1, I only get 1.
I can't figure out how to include the NULLs.
Hope this makes sense?!
August 27, 2009 at 9:06 am
Gillian, take some time and read this...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
then try to ask your question again. Its hard to know how to help you without seeing your object/data structure, and the code you are trying.
Greg
_________________________________________________________________________________________________
The glass is at one half capacity: nothing more, nothing less.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply