Click here to Skip to main content
15,908,834 members
Home / Discussions / Database
   

Database

 
GeneralRe: Problem with a InsertStored Procedure for Vb.net Pin
Vimalsoft(Pty) Ltd8-Nov-07 0:54
professionalVimalsoft(Pty) Ltd8-Nov-07 0:54 
QuestionSql Server 2005 Devloper Edition Pin
Thaer Hamael7-Nov-07 21:43
Thaer Hamael7-Nov-07 21:43 
AnswerRe: Sql Server 2005 Devloper Edition Pin
Pete O'Hanlon8-Nov-07 1:35
mvePete O'Hanlon8-Nov-07 1:35 
Questiondownload message Pin
foladi7-Nov-07 21:42
professionalfoladi7-Nov-07 21:42 
QuestionBitmap Image to Long Binary Stream Pin
sindhutiwari7-Nov-07 19:50
sindhutiwari7-Nov-07 19:50 
Questionselect apperaring in tables Pin
nicetohaveyou7-Nov-07 17:48
nicetohaveyou7-Nov-07 17:48 
QuestionInsert into DB via Web Service [modified] Pin
ssTahoe7-Nov-07 9:08
ssTahoe7-Nov-07 9:08 
QuestionSQL Query Pin
#realJSOP7-Nov-07 9:05
professional#realJSOP7-Nov-07 9:05 
I have three tables.

Modules - contains one or more software modules that the user can subscribe to
Subscribed - contains subscription info for a module that is subscribed to by users
Membership - contains user membership info

The idea is to return all modules whether they are subscribed to by the user or not, but for the subscribed ones, I need all the data from the subscribed and membership tables as well. For modules that are not subscribed to by the user, the columns that came from the subscribed and membership tables would have null values.


More info on the tables:

The Modules table contains 1 or more rows, with one row indicating a unique module (no dupes).

The Membership table contains 1 or more rows, with each row indicating a unique user (no dupes)

userName   UserID  MoreData
john       1       dog
mary       2       cat
bob        3       bear
martha     4       monkey
sally      5       rat


The subscribed table contains 0 or more rows, and there could be multiple rows for a given user (but never more than one row per subscribed module for that user, like so:

<code>userID    moduleID
1         1
1         2
2         1
3         3
3         4
4         3
5         1
5         2
5         3</code>


So, if there were four modules, and I was interested in john's subscription status, I would want this outcome (remember I want all modules in the dataset, but with john's subscription status on the subscribed ones):

<code>ModuleID   ModuleName    UserID   SubscribeDate   LastUpdate  MoreData    UserName
1          Blah          1        1/2/2007        1/2/2007    dog         john
2          Gack          1        2/3/2007        2/3/2007    dog         john
3          Shoot         NULL     NULL            NULL        NULL        NULL
4          Darn          NULL     NULL            NULL        NULL        NULL</code>


I kept the number of columns to a dull roar for the sake of sanity, but it's safe to assume I want all columns from all three tables when appropriate.

Can someone help me out?



"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001


AnswerRe: SQL Query Pin
pmarfleet7-Nov-07 9:28
pmarfleet7-Nov-07 9:28 
AnswerRe: SQL Query Pin
Pete O'Hanlon7-Nov-07 10:50
mvePete O'Hanlon7-Nov-07 10:50 
GeneralRe: SQL Query Pin
Michael Potter7-Nov-07 11:26
Michael Potter7-Nov-07 11:26 
GeneralRe: SQL Query Pin
Pete O'Hanlon7-Nov-07 11:34
mvePete O'Hanlon7-Nov-07 11:34 
GeneralRe: SQL Query Pin
Michael Potter7-Nov-07 11:42
Michael Potter7-Nov-07 11:42 
JokeRe: SQL Query Pin
Paul Conrad7-Nov-07 12:15
professionalPaul Conrad7-Nov-07 12:15 
GeneralRe: SQL Query Pin
#realJSOP8-Nov-07 1:29
professional#realJSOP8-Nov-07 1:29 
GeneralRe: SQL Query Pin
Michael Potter8-Nov-07 3:04
Michael Potter8-Nov-07 3:04 
GeneralRe: SQL Query Pin
#realJSOP8-Nov-07 1:33
professional#realJSOP8-Nov-07 1:33 
QuestionControlling T-SQL output from LINQ to SQL Pin
Mark J. Miller7-Nov-07 8:28
Mark J. Miller7-Nov-07 8:28 
AnswerRe: Controlling T-SQL output from LINQ to SQL Pin
Mark J. Miller7-Nov-07 9:14
Mark J. Miller7-Nov-07 9:14 
GeneralRe: Controlling T-SQL output from LINQ to SQL Pin
Mark J. Miller8-Nov-07 5:36
Mark J. Miller8-Nov-07 5:36 
QuestionExcel into SQLServer2000 Pin
Jedidah7-Nov-07 8:00
Jedidah7-Nov-07 8:00 
AnswerRe: Excel into SQLServer2000 Pin
pmarfleet7-Nov-07 8:24
pmarfleet7-Nov-07 8:24 
QuestionDateTime Query Pin
solutionsville7-Nov-07 6:35
solutionsville7-Nov-07 6:35 
AnswerRe: DateTime Query Pin
solutionsville7-Nov-07 7:50
solutionsville7-Nov-07 7:50 
QuestionDatabase BackUp Pin
kibromg7-Nov-07 1:34
kibromg7-Nov-07 1:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.