Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I have an Insert Select query with works fine -
SQL
INSERT tblASXhistoricals (StockID,TradeTime)
SELECT tblStockPrice.StockID,TradeTime)
FROM tblStockPrice INNER JOIN tblStock ON tblStock.StockID = tblStockPrice.StockID
WHERE tblStock.RIC LIKE '%.AX'


I wish to insert a separate manual value into the query but not at all sure how to do this.
I need to insert a value into the arcTime field as below using VALUES but of course this doesn't work. What would the correct syntax be?

SQL
INSERT tblASXhistoricals (arcTime,StockID,TradeTime)
VALUES ('xxxx',SELECT tblStockPrice.StockID,TradeTime)
FROM tblStockPrice INNER JOIN tblStock ON tblStock.StockID = tblStockPrice.StockID
WHERE tblStock.RIC LIKE '%.AX'


Thanks...
Posted

1 solution

Cancel that.
Figured it out by just entering the text value into the Select line-

SQL
INSERT tblASXhistoricals (arcTime,StockID,TradeTime,OpenPrice,HST_Close,Bid,Ask,LastTrade,Volume) 
SELECT 'mmm',tblStockPrice.StockID,TradeTime,OpenPrice,HST_Close,Bid,Ask,LastTrade,Volume 
FROM tblStockPrice INNER JOIN tblStock ON tblStock.StockID = tblStockPrice.StockID 
WHERE tblStock.RIC LIKE '%.AX'


Thanks anyway
 
Share this answer
 
Comments
PIEBALDconsult 17-Jan-16 20:45pm    
Yup, that's how you do it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900