[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

put constant from select to insert into field  Posgresql

Posted on 2016-10-27
2
Medium Priority
?
175 Views
Last Modified: 2016-11-02
In code line 14   i want to put table name into  field   filname   but this code put all column in each row to filed  filname  how cani fixit

sc_lookup(Dataset, "SELECT  tablename FROM pg_catalog.pg_tables
where schemaname = 'public'and tablename not like 'pong8%' order by tablename") ;

{TabName} = {Dataset[33][0]};

$table = {TabName} ;
echo "$table";

$sql ='INSERT INTO pong8_maintable ("filname","timestamp8","Last","TradePrice", "TradeVolume" , "BestBid", "BidSize", "BestAsk","AskSize" ,"Turnover" ,"CalcVWAP" ,"Flow" ,"TradeFlags"

) 

SELECT
'.$table.' ,
cast(public.'.$table.'."Timestamp" as timestamp) ,
cast(public.'.$table.'."Last" as numeric)  ,
cast(public.'.$table.'."Trade Price" as numeric)  ,  
cast(public.'.$table.'."Trade Volume" as numeric),
cast(public.'.$table.'."Best Bid" as numeric),
cast(public.'.$table.'."Bid Size"as numeric),
cast(public.'.$table.'."Best Ask"as numeric),
cast(public.'.$table.'."Ask Size"as numeric),
cast(public.'.$table.'."Turnover"as numeric),
cast(public.'.$table.'."Calc VWAP"as numeric),
cast(public.'.$table.'."Flow"as numeric),
cast(public.'.$table.'."Trade Flags"as varchar)

FROM Public.'.{TabName}; 


sc_exec_sql($sql);

Open in new window

0
Comment
Question by:teera
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 62

Assisted Solution

by:gheist
gheist earned 1000 total points
ID: 41863513
update table_name set field=select_or_single_value where some_condition
0
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 1000 total points
ID: 41863668
Here is how to use quote marks correctly in PHP.
https://www.experts-exchange.com/articles/12241/Quotation-Marks-in-PHP.html
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question