Solved

SQL Query Help

Posted on 2008-10-30
2
180 Views
Last Modified: 2012-05-05
I have a web site with a membership table (id, lastname, firstname, dateregistered, etc.) and a sessions table (membership id, dateloggedin, etc.) which has a record for each date/time a member has logged into the site. I am trying to determine active members determined by if they have logged into the system within the kast 6 months. I only want to know if they have logged in at least once, I don't want to cound each time they have logged in over the last 6 months. I would like some help on how to write a sql query to give me the results.
0
Comment
Question by:elemke
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 10

Accepted Solution

by:
calpurnia earned 250 total points
ID: 22844112
Assuming your tables are called Membership and Sessions, try something like:

SELECT DISTINCT M.* FROM Sessions S INNER JOIN Membership M
ON M.id=S.[membership id]
WHERE dateloggedin > Date()-183;

It'll depend on what flavour of SQL you're using (the above is the variety used by Access). You'll also save yourself some potential headaches if you avoid field names with spaces in.

0
 

Author Closing Comment

by:elemke
ID: 31511722
Thank you so much, this is exactly what I needed!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In database programming, custom sort order seems to be necessary quite often, at least in my experience and time here at EE. Within the realm of custom sorting is the sorting of numbers and text independently (i.e., treating the numbers as number…
'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question