Skip to content
Advertisement

Tag: string

Stored procedure to unpivot

I have a table with these columns: Where fields from 01 to 50 are dates. I need to have a table like this: Where title code should be the column name from 01 to 50, data should be the value of that column in mytable I did this stored procedure by looking in older questions: but I’m getting a syntax

Conditional Grouping in SQL

This should be easy, but I’m having trouble with it. I have a results table that looks like this: Notice that the pct column sums to 1.0 for each store. Here’s the code to create this table: I’m trying to group the results by store, then by cust_id while creating a new category A&B if the same cust_id has both

How to search in a SQL database table

I have a table with the following columns: user_id user_name user_unit user_last_name user_first_name user_email I want to write a query that the user declares a string that contains a word/part of a word/user_name/user_id/full name/ext. and the query returns all rows the contains the string, sorted by most relevant. Any offers? Answer You can concatenate the columns together and use like:

Advertisement