Jump to content
  • Advertisement
Sign in to follow this  
BTownTKD

[web] SQL query: adding multiple values from different entries and returning the sum

This topic is 3958 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So I have a table that stores the frequency of words from a particular text file. It has the values (filename, word, frequency), to correspond each word to the file it is found in, and the number of times it occurs in that file. I want a query that can take *multiple words*, and will return the *total* frequency of all those words in a given file. For example, if I search for "hello" and "how", and file1 contains "hello" 3 times, and "how" 2 times, it will return <file1, 5> and so on for all files in the database. I'm not really sure how to construct this SQL query in a way that will automatically add the values together. Is it possible in a single query? I also have to sort the results by count and then lexocographically, but I think I can handle that much...

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!