Skip to content
Advertisement

Tag: tsql

How can I join result from two queries

So sorry but I am new to SQL querying and could use a little help. I will like to join results from 2 tables and I can’t seem to get it return results I need. Query 1 Query 2 I tried using union all but I get an error must have equal number of expressions in their target lists. Any

Replace function in SQL Server

I have a string of data I am trying to use the replace function to replace double commas with NULL values Solution But I keep ending up with (The ,,, needs to become ,NULL,NULL, but only becomes ,NULL,,) Here is my sample code I’m using Answer If you do the same replacement twice, any number of sequential commas will get

MS SQL Find a Value in entire column and return true if found

New to SQL trying to find how to do the following : I have a ProductID# ABC123 (Product) I need to check the “workflow” (Workflow) column and see if the Product ID was ever “extended” – there are various workflow steps – Need to check the entire workflow column, if a ProductID was ever “extended” I need to mark “yes”

Correspondence between two tables

I have table the table code_Commune contains gps for the city in general code_Commune: Now I need to do correspondence with the table lead to add code_commune and Nom_Commune: Table lead Is there any way to do correspondence between the two tables? Answer You can find the closest city using some sort of distance measure. First, fix your first table:

Advertisement