Skip to content
Advertisement

Tag: ssms

Join repeats rows too many times

List the employees (first and last name in same column), that work in retail or food and drink. Include the building they work in and shop type. This is what I have. Whenever I run it everything repeats so there’s over a hundred rows now. Can anybody help me? EDIT I’ve tried various joins for this to make this work

Joining two tables when one table has multiple corresponding values

For some background, what I have is an ordering system that populates a database. In the database there are two tables, order_Parent, order_Children. order_Parent contains broader information such as ID, shippingDesination, createdBy, highPriority. There are more columns but the ones that I am focused on are the ID column and highPriority for order_Parent. When looking at the order_children table there

System Catalog vs Information Schema

When looking at SQL Server Management Studio (SSMS), which one is better and why? Are there cases where we should use one over the other? I can’t tell the difference between them. Answer INFORMATION_SCHEMA is there for compatibility, it doesn’t expose all the information about objects on the instance. sys however, fully exposes any relevant information, though you do need

How to select and join field with max date?

I have two tables joined on RECID and AAATRANSPORTORDERRECID : AAATRANSPORTTABLE AAALTLCHANGEREQUEST I need to select the record shown from AAATRANSPORTTABLE and join the AAALTLCHANGEVALUE value for the most recent CREATEDDATETIME from AAALTLCHANGEREQUEST. My query is as below: It produces these results: My desired output is Answer The problem is you are selecting max(l.CREATEDDATETIME) in your select query but you

Advertisement