Skip to content

How to find these master records whose totals are not accurate

I have two tables (master-details relationship). The master table has a column (called total) recording the number of details records for the same master record. Having this column is for the performance reason). Here are the table specs: Because deletion of details records, the total in the master table may …

Inner join on multiple columns in SQL Server

I have two tables tbltask tbluser In tbluser I have two columns, userid and username Sample data: 1 ibrahim 2 nizam 3 shahrukh 4 saddam and in my second table, I have multiple …

sql query to fetch exchange rate

Given a sales table with sales amount stored in local currencies and an exchange rate table containing currency conversion rate, to get total sales amount in USD for each sales date I need query Sales Table: Exchange Rate Table: have no idea how I should proceed I have to do two things match the currency and …

Max Value based on two columns

I have a table with multiple columns that contains both month and year. I’m trying to identify based on column1,column2 what is the greatest month and year. I have a DDL for a test table as such. This is the data in the example table. I want to get the record with the max month and year. When I attempt