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

Do we have any SQL Coders?

Old 12-07-18, 04:13 PM
  #1  
DVD Talk Legend
Thread Starter
 
Join Date: Jan 2001
Location: MA
Posts: 10,020
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 04:19 PM.
Noonan is online now  
Old 12-11-18, 03:58 PM
  #2  
DVD Talk Limited Edition
 
dhmac's Avatar
 
Join Date: Apr 2000
Location: Kissimmee, Florida
Posts: 6,824
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
dhmac is offline  
Old 01-11-19, 09:36 AM
  #3  
Cool New Member
 
Join Date: Jan 2019
Location: Berlin, Germany
Posts: 45
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.
MeridithHartt is offline  

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

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