I have a table of stock quotes, and dates:
StockID QuoteID QuoteDay QuoteClose
---------------------------------------
5 95 2018-01-03 1.080
5 96 2018-01-04 1.110
5 97 2018-01-05 1.000
5 98 2018-01-06 1.030
5 99 2018-01-07 1.010
5 100 2018-01-08 0.899
5 101 2018-01-09 0.815
I create a clustered index to manipulate the data but am running into duplicate key errors with the index
CREATE UNIQUE CLUSTERED INDEX MACD_IDX ON #TBL_MACD_LOOP (StockId, QuoteId)
Different combinations of StockID and QuoteID will result in the same output:
For example (StockID, QuoteID) of (5, 11) and (51, 1) both produce an index of 511.
My solution is to add "-" between StockId and QuoteId.
Now (5, 11) produces 5-11 and (51, 1) produces 51-1.
How do I combine strings with values?
SELECT * FROM #TBL_MACD_LOOP WHERE StockID = <value1> AND QuoteID = <value2>;