Solved

put constant from select to insert into field  Posgresql

Posted on 2016-10-27
2
102 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
2 Comments
 
LVL 62

Assisted Solution

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

Accepted Solution

by:
Ray Paseur earned 250 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Steps to create a PostgreSQL RDS instance in the Amazon cloud. We will cover some of the default settings and show how to connect to the instance once it is up and running.

808 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