Author |
Topic  |
|
kolucoms6
Average Member
  
845 Posts |
Posted - 16 September 2007 : 10:34:40
|
Purpose : ************** To display List of Non-DNC states in a dropdown based on particular campaign.
I have 2 tables. 1) StateMaster : Contains StateID, StateCode, Statename 2) DNCState : Contains DNCStateID,StateID,CampaignID
Now, when I select a particular Campaign from a DropDown , I want to display records form Statemaster but not those records which are there in DNCState.
Suggestion ?
What I tried : ****************
1) Get List of Campaigns 2) Loop through above Campaign List 3) Run query :
SELECT StateList.*, DNCState.CampaignID FROM DNCState RIGHT JOIN StateList ON DNCState.StateID = StateList.StateID WHERE DNCState.CampaignID Is Null OR DNCState.CampaignID<> " & CampaignID
4) Loop through above query. 5) Create one Drop Down select an fill values.
Problem: ********** Not getting things correctly. :-(
|
|
kolucoms6
Average Member
  
845 Posts |
Posted - 16 September 2007 : 11:20:51
|
Few entried from DB:
1) CampaignMaster:
CampaignID CampaignName 9 PVC Travel 10 NHN
2) DNCState
DNCStAteID CampaignID StateID 2 10 2 3 10 9 4 10 11 5 9 2
3) StateList
StateID StateCode StateName 1 AL Alabama 2 AK Alaska 3 AZ Arizona 4 AR Arkansas 5 CA California 6 CO Colorado 7 CT Connecticut 8 DE Delaware 9 FL Florida 10 GA Georgia 11 HI Hawaii 12 ID Idaho 13 IL Illinois 14 IN Indiana 15 IA Iowa
|
 |
|
gary b
Junior Member
 
USA
267 Posts |
Posted - 18 September 2007 : 14:31:41
|
quote: Originally posted by kolucoms6
I have 2 tables. 1) StateMaster : Contains StateID, StateCode, Statename 2) DNCState : Contains DNCStateID,StateID,CampaignID
Now, when I select a particular Campaign from a DropDown , I want to display records form Statemaster but not those records which are there in DNCState.
SELECT StateList.*, DNCState.CampaignID FROM DNCState RIGHT JOIN StateList ON DNCState.StateID = StateList.StateID WHERE DNCState.CampaignID Is Null OR DNCState.CampaignID<> " & CampaignID
As far as I can see, StateList is not one of your tables. Also appears that DNCState is a sub-table of StateMaster. I'm thinking the relationship is incorrect for what you want to display. But I've been wrong before! 
|
 |
|
|
Topic  |
|
|
|