Go Back  DVD Talk Forum > General Discussions > Tech Talk
Reload this Page >

Do we have any SQL Coders?

Tech Talk Discuss PC Hardware, Software, Internet and Other Technology

Do we have any SQL Coders?

Old 12-07-18, 03:13 PM
  #1  
DVD Talk Legend
Thread Starter
 
Join Date: Jan 2001
Posts: 15,762
Received 319 Likes on 231 Posts
Do we have any SQL Coders?

Hoping to get some help on a simple query I need to run. I don't have much experience with code writing; just creating queries in Access in Design View. I need to code this since Access for some stupid reason doesn't have Mode and Median functions built in like Excel and there's far too much data for me to be able to extract all of it and manipulate in a spreadsheet (Excel doesn't support enough rows).

Basically what I have is a table with SKUs, Stores, and Prices. I need to calculate both the Median and the Mode. My quick google search led me to a statement similar to this:

SELECT top 1 Price
FROM Retail_Pricing
GROUP BY SKU, Price
ORDER BY count(*) DESC

Clearly, this isn't working correctly. Simply need the output to be SKU # and Mode/Median. I was hoping the above would get me the Mode. Haven't tried Median yet since that's a bit more involved.

Last edited by Noonan; 12-07-18 at 03:19 PM.
Old 12-11-18, 02:58 PM
  #2  
DVD Talk Limited Edition
 
dhmac's Avatar
 
Join Date: Apr 2000
Location: Kissimmee, Florida
Posts: 7,328
Received 44 Likes on 41 Posts
Re: Do we have any SQL Coders?

Try this:

SELECT top 1 sum(Price)
FROM Retail_Pricing
GROUP BY SKU, Store
ORDER BY 1 DESC
Old 01-11-19, 08:36 AM
  #3  
Senior Member
 
MeridithHartt's Avatar
 
Join Date: Jan 2019
Location: Berlin, Germany
Posts: 254
Received 10 Likes on 6 Posts
Re: Do we have any SQL Coders?

I don't have any knowledge about it but I think we need to extract data from the tables and SELECT statement is used with the name of that table created in the Database.

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Thread Tools
Search this Thread

Archive - Advertising - Cookie Policy - Privacy Statement - Terms of Service - Do Not Sell My Personal Information -

Copyright 2021 MH Sub I, LLC dba Internet Brands. All rights reserved. Use of this site indicates your consent to the Terms of Use.