|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
having a logical problem
hi,
I have a newsletter system. right now there are only 3 newsletter saved in the db but I hope they´ll get 200 or more. Everyone subscribed can choose to get previous newsletters sent. what I want to do is mark every user every time he gets a newsletter. So I could see which users have never gotten a letter, which only the 3rd and so on ... making for every newsletter a column in every user table is no solution, since the table would get very large. writing the ids of the newsletter in one yolumn, seperated ba a "," is not so good either. so is there a solution? maybe making a new table just for marking? please help, thx |
|
#2
|
|||
|
|||
|
RE: having a logical problem
Well, can you assume that a user has already been sent all newsletters after he subscribed? That means you only need to check if the date that the newsletter has been sent is after the date that the person subscribed and before he unsubscribed..
Then, for previous newsletters you simply have a newsletter->user linking table that looks something like : newsletter_received id userid newsletterid And you only write into it if users want a old newsletter sent to them.. That means the linking table won't get too big either. Just an idea.. |
|
#3
|
|||
|
|||
|
RE: having a logical problem
hmm, seems logical enough to me.
thanks |
|
#4
|
|||
|
|||
|
RE: having a logical problem
Quote:
Hi, Try this way. If i am sure, you are maintaining a seperate table for newsletter details and user details. Now take another relation table like 'NewsletterUser' that stores information 'seqNewsletterId' and 'seqUserId' i.e the table structure will be like this CREATE TABLE newsletterreceiver( seqnewsletterreceiverId, seqNewsLetterId, seqUserId, ... ... .. ); When a user requests a newsletter, his Id as well as the newsletter Id (requested) is stored in this table. Now if you want to find the users that didn't received any newsletter, You can write your logic such as: Get all the users from user table whose ids are not in the 'newsletterreceivers' Where seqNewsLetterId = 'x' Hope this solves your problem. You can contact me at sudheer_yakkala@yahoo.co.in |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Database Help > having a logical problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|
|