Skip to content
Advertisement

MAX Date for each row

I am having some difficulty at writing a syntax that will provide me with the most recent date for several results. Little bit of background, I am pulling live data from an IBM AS400, I have no SQL tables, I am connecting to the tables via ODBC, using QTODBC to create my queries, then I export them to Power Bi.

SQL Updated question conditional division

Given columns A and B from Table1: Given columns S, M, L from Table2: I want to create a new column in Table1 that outputs the quotients of values of column B and Avg(Table2.S) only if the entry in the same row in column A of is ‘Small’. If column A has ‘Med’, we divide by Avg(Table2.M) and if it

How to reduce SQL log file size

SQL log file size is very big in our production database and hard disk space left only 2G. Is it safe to delete .ldf file? Answer Check out this post In the interim, this should at least allow you to kill the log file: Perform a full backup of your database. Don’t skip this. Really. Change the backup method of

Showing computed and non-computed data in one column with SQL

I have an MS Access database that has several tables. Of these tables, I have a bin table that shows 84 bins with the bin numbers being the primary key. It has another attribute for TotalCapacity. I have another table for inbound tickets that contains an attribute that accepts a number for bushels of commodity taken in. A third table

Sqlite, using grouping? for subqueries with date ranges

I have a sqlite query that works as-is and it’s used to get an average of date between a date range Again, this works perfectly but I’d like to do some kind of subquery operation that does this same thing for every month and returns the result for each as a different alias like this but my issue is after

I can’t get around INNER JOIN in MySQL

I have two tables in my database. One of which is a table called players and the other one is bans: What I need to do is: select players that where reason = cheating and Score < 250. I tried doing some JOINS when I tried FULL JOIN I found that thing doesn’t exist in MySQL so any help would

efficient way to find last week customer

I have 3 columns(customerid, date_purchased, item) table with 2 weeks of data. I want to retrieve the customers that only bought from the first week. My logic is to find the max date subtract it all the rest of the dates and retrieve customers where that difference equal or less than 7. Here is what I did, but I have

Advertisement