Php code about sql query

for example:
create table testtable (
order_number number(4),
item_id number(4),
quantity number(8),
item_desc varchar2(16)
insert into testtable values (1001,1,10,'apple');
insert into testtable values (1001,2,20,'banana');
insert into testtable values (1002,2,50,'banana');
insert into testtable values (1002,1,30,'apple');
insert into testtable values (1003,3,60,'orange');
insert into testtable values (1004,3,50,'orange');
commit;
Table Test DATA
order_number item_id quantity item_desc
1001 1 10 apple
1001 2 20 banana
1002 2 50 banana
1002 1 30 apple
1003 3 60 orange
1004 3 50 orange
i want to make above sql query output in 3 pages.
order_number item_id quantity item_desc
1001 1 10 apple
1001 2 20 banana
when i click next_page it output below:
order_number item_id quantity item_desc
1002 2 50 banana
1002 1 30 apple
and when i click next_page again it will output below:
order_number item_id quantity item_desc
1003 3 60 orange
1004 3 50 orange
using url:http://www.oracle.com/technology/pub/articles/oracle_php_cookbook/fuecks_paged.html
please look at three php code below:
php code:
<?php
$con = oci_connect('apps','apps','prod');
$sql = "select distinct h.order_number,h.order_type_id,h.price_list_id
from oe_order_headers_all h
where to_char(h.ordered_date,'YYYYMMDD') = '20060627'
and h.org_id = 82
order by order_number ASC";
$result = oci_parse($con,$sql);
oci_execute($result);
echo "<table border = 1>";
echo "<tr><td>order_number</td>";
echo "<td>order_type</td>";
echo "<td>price_id</td></tr>";
while ($rows = oci_fetch_array($result,BOTH_NUM)) {
echo "<tr><td>". $rows[0]."</td>";
echo "<td>".$rows[1]."</td>";
echo "<td>".$rows[2]."</td></tr>";
?>
pager_functions.php
<?php
function total_pages($total_rows, $rows_per_page) {
if ( $total_rows < 1 ) $total_rows = 1;
return ceil($total_rows/$rows_per_page);
function page_to_row($current_page, $rows_per_page) {
$start_row = ($current_page-1) * $rows_per_page + 1;
return $start_row;
function count_rows(& $conn, $select) {
$sql = "SELECT COUNT(*) AS num_rows FROM($select)";
$stmt = oci_parse($conn,$sql);
oci_define_by_name($stmt,"NUM_ROWS",$num_rows);
oci_execute($stmt);
oci_fetch($stmt);
return $num_rows;
function & paged_result(& $conn, $select, $start_row, $rows_per_page) {
$sql = "SELECT
FROM
SELECT
r.*, ROWNUM as row_number
FROM
( $select ) r
WHERE
ROWNUM <= :end_row
WHERE :start_row <= row_number";
$stmt = oci_parse($conn,$sql);
oci_bind_by_name($stmt, ':start_row', $start_row);
// Calculate the number of the last row in the page
$end_row = $start_row + $rows_per_page - 1;
oci_bind_by_name($stmt, ':end_row', $end_row);
oci_execute($stmt);
// Prefetch the number of rows per page
oci_set_prefetch($stmt, $rows_per_page);
return $stmt;
?>
outpages.php:
<?php
$conn = OCILogon('scott', 'tiger') or die ("Unable to connect to db");
require_once 'pager_functions.php';
$rows_per_page = 3;
$url = 'results.php'; // URL to this script
$sql = 'SELECT * FROM testtable ORDER BY rank ASC'; // The unfiltered
// Get the total page count from the number of rows
$total_rows = count_rows($conn,$sql);
$total_pages = total_pages($total_rows, $rows_per_page);
// Make sure the page number is a sane value
if ( !isset($_GET['page']) ||
!preg_match('/^[0-9]+$/',$_GET['page']) ||
$_GET['page'] < 1 ) {
$_GET['page'] = 1;
} else if ( $_GET['page'] > $total_pages ) {
$_GET['page'] = $total_pages;
// Translate the page number into a starting row number
$start_row = page_to_row($_GET['page'], $rows_per_page);
// Filter to a single page of rows
$stmt = & paged_result($conn, $sql, $start_row, $rows_per_page);
?>
<table width="600">
<caption>Feedster Top 500 Blogs [#<?php echo $_GET['page']; ?>]</caption>
<thead>
<tr>
<th>Rank</th>
<th>Blog</th>
<th>Inbound Links</th>
</tr>
</thead>
<tbody>
<?php while (OCIFetchinto($stmt,$row,OCI_ASSOC)) { ?>
<tr valign="top">
<td align="right"><?php echo htmlspecialchars($row['RANK']); ?></td>
<td>
">
<?php echo htmlspecialchars($row['NAME']); ?>
</a>
</td>
<td align="right"><?php echo htmlspecialchars($row['LINKS']); ?></td>
</tr>
<?php } ?>
</tbody>
<tfoot>
<tr>
<td colspan="3" align="center">
<?php echo draw_pager($url, $total_pages, $_GET['page']); ?>
</td>
</tr>
</tfoot>
</table>
?>
above two php codes in the same folder
when i run outpages.php it runs below result:
Feedster Top 500 Blogs [#1]
Rank Blog InboundLinks
may be above php code doesn't output what i mean .
who can help me ?

Hi,
Your table testtable is defined as follows:
create table testtable (
order_number number(4),
item_id number(4),
quantity number(8),
item_desc varchar2(16)
In your script, you are refering to the columns 'RANK', 'NAME', 'URL' and 'LINKS'!!!
They simly doesn't exist.
You simply copied and pasted a snippet from the oracle-php-cookbook without adapting it to your needs. (And I assume without understanding, what that code will do.)
Greetings from Hamburg
Thorsten Körner

Similar Messages

  • Pagination of output  php code with sql code

    if one program of php including sql query
    it seems to output wrong .(means some data will be calculated sum)
    if php code output all data in one page.pagination
    it seems to output right(means some data will be calculated sum)
    if there has column of company including two companies of A and B.
    and if each page output 3 lines while A company has 4 lines in sql query,so
    the last line of A company will output in second page,
    i want to calculate A company including 4 lines sum
    how to calculate sum of company of A in second page.
    i think it will be a good interesting question of php code with sql code.
    who can solution thus question ?
    thanks !

    Hi,
    for Example:
    SELECT sum(quantity * price)
    FROM orders
    WHERE COMPANY = 'A';
    This will give you the total amount for company A.
    But remember that your example table will give no output, since you have no price column. So you must decide, what which sum to calculate.
    A sum only calculated over the quantity makes IMHO no sense, because there are apples and bananas ...
    Greetings from Hamburg
    Thorsten Körner

  • A difficult problem with php code and sql code

    it's good place to visit(Paged Result Sets with PHP and Oracle)
    http://www.oracle.com/technology/pub/articles/oracle_php_cookbook/fuecks_paged.html
    maybe below part php code could not be used in above address's php code.
    if((isset($l_company) and $l_company != $rows['COMPANY']) or empty($stmt) and empty($total_pages) ) {
    echo "<tr bgcolor='#CCFFCC'>";
    echo "<td colspan= 3 align='center'>".$l_company."</td>";
    echo "<td >".$totalcomany." </td>";
    $totalcomany = 0;
    echo "<td > </td>";
    echo "</tr>";
    $l_company = $rows['COMPANY'];
    because the same company in one page could calculate sum while if
    the same company in two pages could not do that.
    and what do you think of ?
    thanks !

    Hi,
    this is because your sql-statement selects only the rows, you need to build this one page.
    Neither php nor the given result from your query knows about data wich will be part of the result of another page.
    Greetings from Hamburg
    Thorsten Körner

  • About sql query

    create table test (
    company varchar2(2),
    order_number number(4),
    item_id number(4),
    quantity number(8),
    item_desc varchar2(16)
    insert into test values ('A',70700000171,914,700,'a');
    insert into test values ('A',70700000171,17,800,'b');
    insert into test values ('B',70200001200,3836,105,'c');
    insert into test values ('B',70200001200,3722,42,'d');
    insert into test values ('B',70200001200,3046,52,'e');
    insert into test values ('B',70200001200,35,200,'f');
    commit;
    Table Test DATA
    company order_number item_id quantity item_desc
    70700000171 914 700 a
    70700000171 17 800 b
    A 1500
    70200001200 3836 105 c
    70200001200 3722 42 d
    70200001200 3046 52 e
    70200001200 35 200 f
    B 399
    1899
    how to make above result in using sql query ?
    thanks !

    Hi,
    You can put one more column in ORDER BY clause.
    "afiedt.buf" 8 lines, 310 characters
      1    SELECT * FROM (
      2    SELECT Company ,NULL order_number ,NULL item_id ,NULL ITEM_DESC,  sum(QUANTITY) Quantity FROM test
      3    GROUP BY ROLLUP(COMPANY), NULL,NULL, NULL
      4    UNION ALL
      5    SELECT company ,order_number , item_id ,  item_desc ,quantity  FROM test
      6    )
      7*  ORDER BY company,QUANTITY , ORDER_NUMBER
    SQL>/
    CO    ORDER_NUMBER    ITEM_ID ITEM_DESC          QUANTITY
    A      70700000171        914 a                       700
    A      70700000171         17 b                       800
    A                                                    1500
    B      70200001200       3722 d                        42
    B      70200001200       3046 e                        52
    B      70200001200       3836 c                       105
    B      70200001200         35 f                       200
    B                                                     399
    C      71400000502         32 g                      -598
    C                                                    -598
                                                         1301
    11 rows selected.

  • About SQL Query using joins

    Hi,
    I want to write a SQL statement using Joins. The base table "A" has about 100 fields and the join table "B" a few. I would like to fetch all fields from table "A" and a few from table "B".
    Is there a way to write a query wherein I can use "Select * " for table "A" rather than writing all 100 field name in the query? Please keep in mind that I want to use a Join.
    Thanks.

    Hi Thomas,
    but if there are some fields which are in both tables, SELECT * will be not sufficient. E.g. fields ERNAM, ERDAT, AENAM, AEDAT are such fields which can occur in more tables. In case that a target area will contain these fields, by * with addition INTO CORRESPONDING FIELDS OF, you are not able to specify from which table these values should be taken. In such case, it can be solved by specifying field list dynamically. If it is not that case SELECT * is sufficient. You should check intersection of common fields for tables you are joining. Thereafter you should decide if you can use SELECT *.
    Maybe for better understanding, what exactly I am talking about, look at this example:
    TYPES: BEGIN OF ts_data,
            ernam TYPE mara-ernam,
           END OF ts_data.
    DATA: ls_data TYPE ts_data,
          ls_mara TYPE mara,
          ls_mchb TYPE mchb.
    START-OF-SELECTION.
      ls_mara-matnr = '1'.
      ls_mchb-matnr = ls_mara-matnr.
      ls_mara-ernam = 'A'.
      ls_mchb-ernam = 'B'.
      INSERT mara FROM ls_mara.
      INSERT mchb FROM ls_mchb.
      SELECT SINGLE * FROM mara INNER JOIN mchb ON mara~matnr = mchb~matnr INTO CORRESPONDING FIELDS OF ls_data.
      ROLLBACK WORK.
    You as a developer are not able to tell from which table common fields should be selected. But maybe this is really too specific case...
    Regards,
    Adrian

  • Help about SQL Query

    Hi All,
    I have 3 tables. DEV,APPS,DISC
    DEV Contains data as follows.
    Cardnum    Stat   Flag
    324657      A      GAPPS contains as follows.
    Cardnum Stat balance Product
    324657 A 90 HYG
    3276890 D 0 BNH
    32675 S 89 HGF
    DISC contains
    Cust_Num     Num
    898777          1
    231321          2
    38927          898now I have written SELECT query as follows.
    SELECT c.cardnum, cust_num
      FROM tmp.ccard_gen g,
           tmp.ccard_tmp c,
           ods.phonenr p
    WHERE flag         = 'V'
       AND c.cardnum       = g.cardnum
       AND '32' || p.num   = c.cardnum
       AND c.balancel > 0
       AND c.product = 'SEWING';I don't have product SEWING in DISC and flag 'V'. so I am going to Insert those two values into two tables and then trying to retrieving the records by using above mentioned SELECT Statement.
    But I want to write a single query for Inserting records into those 2 tables and retrieving the records.
    can any one please help me out to writ a query for the issue.
    Thank you,

    You can't insert records with a query. These are two different things.
    What you can do is generate records on the fly
    e.g.
    SQL> ed
    Wrote file afiedt.buf
      1  with myemps as (select empno, ename, sal from emp
      2        union all select 8000, 'FRED', 1000 from dual
      3        union all select 8001, 'BOB', 1200 from dual)
      4  --
      5  select *
      6* from myemps
    SQL> /
         EMPNO ENAME             SAL
          7369 SMITH             800
          7499 ALLEN            1600
          7521 WARD             1250
          7566 JONES            2975
          7654 MARTIN           1250
          7698 BLAKE            2850
          7782 CLARK            2450
          7788 SCOTT            3000
          7839 KING             5000
          7844 TURNER           1500
          7876 ADAMS            1100
          7900 JAMES             950
          7902 FORD             3000
          7934 MILLER           1300
          8000 FRED             1000
          8001 BOB              1200
    16 rows selected.
    SQL>

  • SQL Query in HTML

    Hi,
    I've been trying to create a header using HTML. I was wondering how I can put an SQL query inside HTML codes.
    Here are HTML code and SQL Query:
    HTML:
    <table width="100%" height="135" border="0">
    <tr>
    <td width="100%" bgcolor="#FFFF33"><span class="style9"><br></span><span class="style9"></span></td>
    </tr>
    <tr>
    <td width="100%" bgcolor="#FFFFCC"><span class="style6"><br>
    FOCUS LIST <span class="style8">FUND FACT SHEET</span></span><br>
    <span class="style7">THIS IS WHERE THE SQL QUERY WILL RETURN <br>
    <br>
    </span></td>
    </tr>
    </table>
    SQL Query:
    select     "MFR_STRATEGY_INFORMATION"."SI_NAME" as "SI_NAME"
    from     "MFR_STRATEGY_INFORMATION" "MFR_STRATEGY_INFORMATION",
         "MFR_POOL_MONEY" "MFR_POOL_MONEY",
         "MFR_MSTAR_FEED" "MFR_MSTAR_FEED"
    where "MFR_MSTAR_FEED"."MSF_FUNDID"="MFR_POOL_MONEY"."F_MSF_FUNDID_FK"
    and     "MFR_STRATEGY_INFORMATION"."SI_SYS_ID"="MFR_POOL_MONEY"."F_SI_SYS_ID_FK"
    and      "MFR_MSTAR_FEED"."MSF_SECID" =:P55_SECID

    Hello,
    Create a hidden item and specify as source your select statement so the item contains the value you want.
    In your html region you specify the item like &P1_ITEM. and you should see the value.
    Regards,
    Dimitri
    http://dgielis.blogspot.com/
    http://www.apex-evangelists.com/
    http://www.apexblogs.info/
    REWARDS: Please remember to mark helpful or correct posts on the forum

  • How to write this sql query in php code ?

    for example:
    insert into temp
    select *
    from testtable;
    after this, i will query data from sql below:
    select *
    from temp;
    how to write this php code ?
    who can help me ?
    thanks!

    Have a look at the manual to find out how to issue queries.
    http://us3.php.net/oci8

  • APEX,PDF's, BI Publisher and SQL Query returning SQL code..

    I don't know if I should be posting this in this Forum or the BI Publisher forum, so I am posting in BOTH forums..
    I love APEX, let me say that first.. And appreciate the support offered here by the group, but am running int a confusing issue when BI Publisher tries to build a report from the above type APEX report..
    Here is my dilemma:
    I have a number of reports that are part of a Oracle package. They return an SQL Query back to a reports region on a page. I am having to deal with the column names returned are col01, col02..
    The issue I have is, when building the Application Level query to download the XML sample from in building RTF layouts in Word, you can not use this code, you MUST use a standard SQL Select.
    I have taken the sql from the function returning sql, and copied into the application query, supplying the required data values for bind variables being used in the query.
    An XML file is produced, and I use this to build the RTF format file that I load back into APEX and try to use it for the PDF rendering of the report. I can view the output as a PDF in the Word add on, but when I try using it with the report, it is returning an empty PDF file.
    Can anyone tell me what error log files on the bi publisher side I can look at to see what error is happening?
    Thank you,
    Tony Miller
    UTMB/EHN
    Title adjusted to allow people to know what I am talking about...
    Message was edited by:
    Tony Miller

    Tony,
    You can find the log as follows:
    - go to http://[yourserver]:[yourport]/em
    - logon to OC4J EM: oc4jadmin/[yourpassword]
    - click on "logs" at the bottom of the page
    - in the hgrid/tree, expand OC4J->home->Application
    xmlpserver
    - click on view log icon
    You can also observe what's going on in BI Publisher
    by going to the command prompt from where you started
    it.
    Or, as a third option, you can locate the file on
    your file system, depending on your setup, the path
    would be something similar to this:
    \oracle\product\10.2.0\bip\j2ee\home\application-deplo
    yments\xmlpserver\application.log
    With that said though, I don't expect you'll find
    much in there that would help with your particular
    problem. I suspect you either get no rows in your XML
    at runtime, due to some session state issues, or your
    XML structure does in fact not match your RTF
    template.
    I'm not quite following your problem description,
    i.e. when did you do what and are you associating
    your report layout with a report query or report
    region. So just some general notes, your query needs
    to be parseable at design-time, when exporting the
    XML, so that you get the XML file with the proper
    column names derived from your query. If you want to
    use your RTF template with a standard report region,
    you must export the XML file first using the advanced
    XML structure option. And of course the column names
    in your report query need to match the column names
    in your report region.
    Perhaps this helps you further diagnose what's going
    on, if you have additional information that could
    help, let me know. And if you could stage this on
    apex.oracle.com, I'd be happy to take a look.
    Regards,
    MarcMarc,
    Thanks for looking at this issue. Below find my remarks to your questions..
    Re: your query needs
    to be parseable at design-time, when exporting the
    XML, so that you get the XML file with the proper
    column names derived from your query.At the start of this process, the query code was a function in a package. The function was returning an SQL select statement, for a report region on a page. I took the select statement, built an application query to build a sample of the xml for BI Publisher desktop (Add-on for Word). The code was producing the usual Col01, Col02.. since at design time that is were the column names.
    When I then took the xml from this and built the rtf for loading into my APEX application.
    When testing the Application Query with this RTF report layout, I am getting PDF's. When using it with the report region sending an xml feed to BI Publisher I am getting nothing back.
    I have since taken the sql code and moved it back into the report region, and set the region to have a type of straight SQL Query. I have even tried to hard-code the parameters I was getting from the page to limit data returned.
    Is it possible to see the xml being produced by the APEX page?
    Re: Stage this on apex.oracle.com.. I would love to, but we would have HIPPA issues if I posted the data on a public website.
    Can I send you the RTF file and the xml file that the application query is creating to see if there something weird about them?
    Thank you,
    Tony Miller
    UTMB/EHN

  • Some question about sql code

    for example:
    select
    from testtable
    outputs below results:
    item_desc
    950gapple(z)110ml*40
    650gbanana(z)215ml 1x18
    make above example outputs below result:
    item_desc
    a950gapplez110ml40
    a650gbananaz215ml1x18
    how to write above sql code?
    who can help me?
    thanks

    Jameel Provided solution to one of your other thread
    a question about sql code
    Try the below query. You can modify the TRANSLATE function to add the characters you want to remove from the string.
    select 'a'||replace(translate(str,'()* ','`'),'`') from testtable

  • How to execute SQL Query in Code behind Using infopath 2010?

    Hi,
    I've repeatable on infopath form, and want bind it throuth code behind from SQL table. My question is that how to execute SQL Query in code behind from infopath as well as how would get Query result to bind repeatable control?
    Thanks In Advance
    Shoeb Ahmad

    Hello,
    You first need to add new SQL DB connection then you need execute connection from code behind.
    See below link to create new connection
    http://office.microsoft.com/en-in/infopath-help/add-a-data-connection-to-a-microsoft-sql-server-database-HP010092823.aspx:
    http://www.bizsupportonline.net/infopath2010/connect-infopath-2010-sql-server-2008-table.htm
    Then use below code to execute this connection:
    AdoQueryConnection conn = (AdoQueryConnection)(this.DataConnections["Data connection name"]);
    string origCommand = Select * from tablename;
    conn.Command = origCommand;
    conn.Execute();
    Finally bind your table:
    http://www.bizsupportonline.net/infopath2007/4-way-programmatically-add-row-repeating-table.htm
    http://stevemannspath.blogspot.in/2010/09/infopath-20072010-populate-repeating.html
    Hope it could help
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • How i can execute the sql query in java code

    I already have sql query in jave plateform i need to execute this code how i can do that. i have unix env and with oracle database. should i just run this query in my sqlplus. this file has extention .java. thanks

    you can create a project in JDeveloper add the java file to it, add the Oracle JDBC library to the project properties and then hit the run button.

  • Datasource works with java code but not with sql:query dataSource=...

    Hello everyone! I have a small problem with binding a DataSource object via JNDI and retrieving it in a web application. This is the case:
    I did not wish to make the DataSource available through the server.xml, because I want to create applications that can be bundled in a simple .war file. So I create the DataSource when the context is created in the contextInitialized() method of ServletContextListener like this:
    InitialContext initialContext = new InitialContext();
    Properties properties = new Properties();
    properties.setProperty( "driverClassName", "com.mysql.jdbc.Driver" );
    properties.setProperty( "factory",   "org.apache.commons.dbcp.BasicDataSourceFactory" );
    properties.setProperty( "username", servletContext.getInitParameter( "dbUser" ) );
    properties.setProperty( "password", servletContext.getInitParameter( "dbPass" ) );
    properties.setProperty( "url",      servletContext.getInitParameter( "dbUrl" ) );
    properties.setProperty( "defaultAutoCommit", "false" );
    properties.setProperty( "maxActive",         "25" );
    properties.setProperty( "initialSize",       "15" );
    properties.setProperty( "maxIdle",           "10" );
    properties.setProperty( "testOnBorrow",      "true" );
    properties.setProperty( "testOnReturn",      "true" );
    properties.setProperty( "testWhileIdle",     "true" );
    properties.setProperty( "validationQuery",   "SELECT 1" );
    properties.setProperty( "removeAbandoned",   "true" );
    DataSource dataSource = BasicDataSourceFactory.createDataSource( properties );
    initialContext.rebind( "daers", dataSource );Please comment if you think this is a bad idea!
    All the above seems to work fine. When I try to retrieve the DataSource in a .jsp file then it all works fine like this:
    <% try {
            javax.naming.InitialContext initialContext = new javax.naming.InitialContext();
            java.sql.Connection conn = ( ( javax.sql.DataSource )initialContext.lookup( "daers" )).getConnection();
            java.sql.Statement statement = conn.createStatement();
            java.sql.ResultSet resultSet = statement.executeQuery("SELECT users.name FROM users;");
            while (resultSet.next()) {
                System.out.println(resultSet.getString(1));
        } catch ( java.sql.SQLException e ) {
            e.printStackTrace();
        } catch ( javax.naming.NamingException e ) {
            e.printStackTrace();
    %>But when I try to execute the same sql query through the appropriate JSTL taglib I get a:
    javax.servlet.ServletException: Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver"The JSTL code I use is this:
    <sql:query dataSource = "daers" var = "query" scope = "page">
            SELECT users.name
            FROM users
        </sql:query>I do put both of the two above pieces of code in the same .jsp page and the first works but the second causes the exception...
    Any clues..?
    Is it illegal to lookup a DataSource in <sql: dataSource=...> if the DataSource is not registered in the server.xml file..?
    If so, do I have any alternatives (like putting the DataSource as a servlet context variable)..?

    I added a response in your original message:
    http://forum.java.sun.com/thread.jspa?messageID=9629812
    Let's keep to it since splitting things across two posts might be confusing.

  • SQ01 DIsplay Problem (Can v write abap code ) Sql Query

    Hi
    Need help in SQL Query
    I generated one sql query which has the following output in general .
    Customer   name   description   amount
    asrq1  sharekhan      Amount payed      10
    asrq1  sharekhan     Amount Advance     20
    asrq1  sharekhan    Amount due             30
    but i need the output in the following way
    Customer  name  AMount payed     Amount  Advance                  Amount Due
    asrq1   sharekhan  10    20     30
    and iam new this sql query but came to know we can write code ..but iam unable to initiliaze to write
    a peace of code as i dont know what are the select-options defined ..i saw in the include but didnt got it
    % comes prefix of select-options,and iam unable to get he internal table which is displayed in the query .
    can anyone help me in this answers will be awarded points.

    First, I will suggest to go for ABAP report for this kinda requirement.
    If you really want to go for it through SQ01, even then you will have to write some ABAP to display the records in one row. You will need to create three custom fields.
    I will give Psudo for one field:
    Field Name := ZAmountPayed
    Select Amount_Payed into varAmountPayed from Table Where Emp# = '12345'
    ZAmountPayed := varAmountPayed
    Convert the above into relative ABAP code and create 2 more similar fields, and you should be all set.
    You have to know the table names and any other calculations to get the right data.

  • Is it possible to write an abap code be SAP SQL query.(ECC 6)

    hello guys,
    Is it possible to write an abap code be SAP SQL query.
    Scenario : table A has a field say f1 of length 10 and table B has a field say s1 of lenght 20. in sap sql i am able to link all the other tables but i am not able to link
    table Af1 --->Table Bs1. as the length doesnot match. so is it possibel that using abap code I can pick 10 characters from table A field f1 adjust it to 20 characters using abap and map it to field s1 of table B.
    Please let me know how to accomplish this if possible.
    thanks in advance!!

    Herm,
    Adding code is done in the infoset.
    Please do following:
    > Goto SQ02
    > Type in the infoset that the basis for your query, <change>
    > Press <code> OR <shift><f8>
    > Tou'll see 4 tabs: Extras, Selections, Code, Enhancements.
    > GoTo tab Code
    > Choose the coding section (<f4> gives you an overview)
    > Enter the code.
    You may set a breakpoint to see what the query in SQ01 will do with it.
    Succes!
    Frank

Maybe you are looking for

  • Update the FI document with the PO customer number

    Hi, Is it possible to update a header field or item line field of customer of the FI document with the PO customer number or sales document of PO (VBAK-VBELN) at the billing moment. I cannot do by standard substitution because the original field is n

  • Data tuncated in file adapter scenario

    Hi, File adapter scenario - Sender systems passes a file (csv format) to PI which has one of field as 0001. This field is received at PI without the prefix 000. But, the target systems requires the data to be in the same format as the sender. How to

  • Why can't i open my trash? I click open and nothing opens in finder.

    Just got a new imac with mountain lion and for some reason i cant open my trash. The only answer i've been able to find is to: "Open a finder window and press cmd+shift+g then i that window type "~/.Trash" Theres no reason i should have to type this

  • What will happen if I quit the installer?

    What will happen if I quit the installer? It seems to be stuck a the last step "Time Remaining: About a minute"but the installer application is responsive. What are the consequences of quiting the installer?

  • Sun Studio 11: Cannot create a new file

    When I want to create a new *.h or *.cc file in my CVS mounted directory tree, studio raises it's famous "Unexpected Exception" dialog with a java stack trace. I have them prepared if you want, I just wanted to check before if there is some already k