Skip to content

Tag: sql

sql – Add 0 after a numeric value

I have columns in my sql table. I am wondering how can I add zero after numeric values in my columns. So for example: I have values e.g 9, 2, 7, 10. I want to add a zero after these numbers. I want them to be 90, 20, 70, 100. There are some values in the columns that already have

How to use Distinct OR Group by with Inner Join?

have a problem with sql query, simple one but though I’m sitting on it 3d day and cant figure out what is wrong, please help. Table 1: Table 2 Result Desired result – in my reslt I want to display each portfolio ID ONLY ONCE. sql query: Any ideas / solutions are welcomed. Thank you Answer Use row_…

Building an Employee Date Matrix

I have a list of employees, along with list of cities they’ve worked in. I need to build a matrix (in SQL Server) of start/end dates by city to determine where they were at any given period in time. The “end date” would be exactly the date before they appeared at a new location. I’ve i…

Check the number of digits or their range

I tried to create a table for save Tradeshows and I need to save Year and Month into different columns. I have a problem with my back-end and front-end developers for check data. I need to check years is 4 number and month between 1-12. Speed is important to me. Answer Just use check constraints: Or, you coul…