Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8853341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:37:42+00:00 2026-06-14T13:37:42+00:00

I am a novice sql programmer so i need a little help trying to

  • 0

I am a novice sql programmer so i need a little help trying to get a query extraction.

I need to get the unique songs played out of a table per week.

Say in a certain week there have been played 8 different songs but those 8 songs have been played numerous times each, i just want the 8 songs to show up.

I need this done by joining 2 tabels, a STATS table and a PLAYLIST table

SELECT playlist.p_title AS title, stats.s_week AS week, playlist.p_artist AS artist, p_id
FROM stats, playlist
WHERE stats.s_pid = playlist.p_id
AND s_uid =31
ORDER BY s_week DESC
LIMIT 0 , 30 

This is my original query that gives me all the songs that has been played in all weeks, even if they have been played a number of times in each week, which is what i dont want.

Anyone able to help me distinct the songs per week?

Thanks in advance – Rasmus

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T13:37:43+00:00Added an answer on June 14, 2026 at 1:37 pm
    SELECT playlist.p_title AS title, stats.s_week AS week, playlist.p_artist AS artist, p_id
    FROM stats, playlist
    WHERE stats.s_pid = playlist.p_id
    AND s_uid =31
    group by playlist.p_title, stats.s_week,playlist.p_artist
    ORDER BY s_week DESC
    LIMIT 0 , 30 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

SQL novice here. I'm trying to get a list of invoice numbers. There are
I'm a novice to SQL scripting. I am trying to figure out a design
I'm a SQL novice, trying to understand how to do a slightly complicated query.
SQL novice here. I'm trying to generate a costing query that outputs employee time
I'm a novice when it comes to SQL and PHP, and I'm trying to
Hope someone can help - I am a novice SQL hacker (and very bad
database/SQL novice here. I have a table with a column called, for example, EmployeeID.
I'm a complete SQL novice, and I'm trying to accomplish the following (pseudo-code) with
I am a NOVICE SQL ADMIN... I am trying to add a column 'ID'
I'm a relative sql notice, eager to learn, but I need some help putting

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.