Relative Content

Tag Archive for sqlsql-serverjoin

SQL New and Old Value based on another table

I have a table which contains information of an equipment location (where the equipment is installed as per Area and Sub-Area) sample of table is here. LocationId is the unique key.
enter image description here

The meaning of JOIN operator

What does JOIN operator mean in SQL? Is this logical operator,arithmetical operator,relational operator or arithmetic-logic one? (multiple choice test)
The question is confusing me but I’d say it’s only the logical operator since I haven’t heard of relational ones.

Joins where 1 table has duplicated entries

I have a database with a products table and another table product_details which has additional product details but this table also has historical entries for each product.

Is there a way to select the biggest/largest/latest transaction in a list?

If I have a set of transactions and want to pick out the full transaction of the largest or latest transaction, how do I identify and extract that transaction. e.g. given a table like
| ID | ItemID | Qty | Value | TranDate | CustID |
|——|——–|—–|———|———–|———-|
|11254 | a123 | 10 | 123.60 |10/01/2021 | FH12AH |
|11236 | a124 | 1 | 1123.60 |15/01/2021 | FH12AH |
|1123 | a129 | 9 | 23.10 |15/01/2021 | FH12AH |
|11237 | a125 | 5 | 213.10 |15/01/2021 | FH12AH |
|2134 | a123 | 3 | 37.08 |15/01/2021 | QB876G |
|3412 | b987 | 31 | 123.60 |23/01/2021 | QB876G |
|4321 | jp34 | 5 | 123.60 |30/01/2021 | JH8765 |
|4322 | a123 | 51 | 1123.60 |02/01/2021 | TT6548 |