Solved

put constant from select to insert into field  Posgresql

Posted on 2016-10-27
2
40 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 61

Assisted Solution

by:gheist
gheist earned 250 total points
Comment Utility
update table_name set field=select_or_single_value where some_condition
0
 
LVL 108

Accepted Solution

by:
Ray Paseur earned 250 total points
Comment Utility
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

Easy Project Management (No User Manual Required)

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo‚Ķ
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.
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

744 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now