I need help making a query into a recordset
I have a detail page with a query that uses the "IN" statement to select from multiple states from the state_label field in my table
and display the zips, cities, and counties related to those states.
The query works great if I use regular menus with a single selection, but I need a comma separated menu
to be used to allow for multiple zips, cities and counties to be selected.
In order to make a texbox into a comma separated menu, I need to define my recordset to retrieve the values, I just can't figure out how to make amy query into a recordset.
This is the query.
<?php require_once('../Connections/duitop.php'); ?>
<?php $state_list = $_REQUEST['States_served']; ?>
<?php
mysql_select_db($database_duitop, $duitop);
$query_TONY = ("SELECT * FROM zip_code WHERE state_label IN (";
for ($i=0; $i<=count($state_list)-1; $i++) {
//echo $state_list[$i];
$query_TONY = $query_TONY . "'" . $state_list[$i] . "'";
if ($i < count($state_list)-1) {
$query_TONY = $query_TONY . ", ";
$query_TONY = $query_TONY . ") GROUP BY county ORDER BY state_label, city ASC");
?>
CAn any one please help with this problem , I've been trying for a week with no luck.
This is the way my detail page looks like.
Cities, Counties, and Zipcodes in your states
As far as I know this will be included in the next ISO release. I solved it by manually bringing the dmraid package to the install and wrote a guide on installing your root system on dmraid. However when the system crashes I have the slight inconvenience of having to install dmraid and manually mount the sets to do a recovery. I guess this is the part you want to get rid of aswell. I decided to wait until the next holy ISO.
Similar Messages
-
Complete novice needs help getting SQL Query into Crystal Reports XI
Post Author: MissMarnie
CA Forum: Data Connectivity and SQL
So I was given an intro level web course and a monster reference guide in prep to format a report. One of our developers wrote me everything I need for the report into a SQL Query and now I'm supposed to format it in CR XII literally do not know what to do from here. I'm able to set up the correct server as a datasource, if that's useful, but I don't know how to make the querey into a bunch of formattable fields in CR. If anyone can walk me through this, I'd be so grateful. I've attempted to look up SQL query in both the help and the book but I keep hitting a wall. The help dialog says things like "press this button" with no reference to what "this button" is. I'm sure it's obvious to the knowledgeable but I'm in a complete fog. Thanks in advancePost Author: synapsevampire
CA Forum: Data Connectivity and SQL
IF you're trying to get assistance with setting up a query as the source for a report, try posting your Crystal version and the database type.
Different software works differently.
In CR 9 and above, under the connection to the database you'll see Add Command. Select that and you can paste the query in.
As for not knowing how to generate a report, that requires experience, there's no generic solution of course..
-k -
Need Help on below Query.
Hi All,
Need Help on below Query.
Consider,
"test9" Table Data in COLUMN "Name" AS
Name
=====
'a'
'b'
'c'
'd'
'e'
I am writing a query as :
SELECT * FROM test9 WHERE Name IN ('a','b','c','d','e','f','g')
I want result set as , It should show data as -
'f'
'g'
i.e. data which does not exists in the table and which is give in in clause
Is it possible in a single query.You can put the data that is to be checked for into a table instead or an inline view, for example:
with t as
(select 'a' as c1 from dual
union all
select 'b' from dual
union all
select 'c' from dual
union all
select 'd' from dual
union all
select 'e' from dual)
select c1 from (select 'a' as c1 from dual
union all
select 'b' from dual
union all
select 'c' from dual
union all
select 'd' from dual
union all
select 'e' from dual
union all
select 'f' from dual
union all
select 'g' from dual)
minus
select c1 from t
C
f
g
2 rows selected. -
Need help with SQL Query with Inline View + Group by
Hello Gurus,
I would really appreciate your time and effort regarding this query. I have the following data set.
Reference_No---Check_Number---Check_Date--------Description-------------------------------Invoice_Number----------Invoice_Type---Paid_Amount-----Vendor_Number
1234567----------11223-------------- 7/5/2008----------paid for cleaning----------------------44345563------------------I-----------------*20.00*-------------19
1234567----------11223--------------7/5/2008-----------Adjustment for bad quality---------44345563------------------A-----------------10.00------------19
7654321----------11223--------------7/5/2008-----------Adjustment from last billing cycle-----23543556-------------------A--------------------50.00--------------19
4653456----------11223--------------7/5/2008-----------paid for cleaning------------------------35654765--------------------I---------------------30.00-------------19
Please Ignore '----', added it for clarity
I am trying to write a query to aggregate paid_amount based on Reference_No, Check_Number, Payment_Date, Invoice_Number, Invoice_Type, Vendor_Number and display description with Invoice_type 'I' when there are multiple records with the same Reference_No, Check_Number, Payment_Date, Invoice_Number, Invoice_Type, Vendor_Number. When there are no multiple records I want to display the respective Description.
The query should return the following data set
Reference_No---Check_Number---Check_Date--------Description-------------------------------Invoice_Number----------Invoice_Type---Paid_Amount-----Vendor_Number
1234567----------11223-------------- 7/5/2008----------paid for cleaning----------------------44345563------------------I-----------------*10.00*------------19
7654321----------11223--------------7/5/2008-----------Adjustment from last billing cycle-----23543556-------------------A--------------------50.00--------------19
4653456----------11223--------------7/5/2008-----------paid for cleaning------------------------35654765-------------------I---------------------30.00--------------19
The following is my query. I am kind of lost.
select B.Description, A.sequence_id,A.check_date, A.check_number, A.invoice_number, A.amount, A.vendor_number
from (
select sequence_id,check_date, check_number, invoice_number, sum(paid_amount) amount, vendor_number
from INVOICE
group by sequence_id,check_date, check_number, invoice_number, vendor_number
) A, INVOICE B
where A.sequence_id = B.sequence_id
Thanks,
NickIt looks like it is a duplicate thread - correct me if i'm wrong in this case ->
Need help with SQL Query with Inline View + Group by
Regards.
Satyaki De. -
I need help making Adobe Edge animation appear correctly on iphones, ipads and android phones. It currently looks fine on desktops and androids. I am using wordpress with a responsive theme (Canvas). I will need you to document The url is http://adamhtc.org.s183459.gridserver.com.
Thanks George, interesting thought. I looked on Adobe's site and they "advertise" fillable forms for the iPhone and Android markets, but on the Windows Phone tab, that is mysteriously missing. lol Maybe it will come later? Meanwhile, I'll google to see if there are any PDF viewers that can handle it now. Thanks for the reply. :-)
-
My grandma is a new apple user and she needs help making an apple account.
my grandma is a new apple user and she needs help making an apple account.
She should call Apple support or visit the Genius Bar at an Apple store (make an appointment first at http://apple.com/retail). They will walk her through the process.
-
Please, need help with a query
Hi !
Please need help with this query:
Needs to show (in cases of more than 1 loan offer) the latest create_date one time.
Meaning, In cases the USER_ID, LOAN_ID, CREATE_DATE are the same need to show only the latest, Thanks!!!
select distinct a.id,
create_date,
a.loanid,
a.rate,
a.pays,
a.gracetime,
a.emailtosend,
d.first_name,
d.last_name,
a.user_id
from CLAL_LOANCALC_DET a,
loan_Calculator b,
bv_user_profile c,
bv_mr_user_profile d
where b.loanid = a.loanid
and c.NET_USER_NO = a.resp_id
and d.user_id = c.user_id
and a.is_partner is null
and a.create_date between
TO_DATE('6/3/2008 01:00:00', 'DD/MM/YY HH24:MI:SS') and
TO_DATE('27/3/2008 23:59:00', 'DD/MM/YY HH24:MI:SS')
order by a.create_dateTake a look on the syntax :
max(...) keep (dense_rank last order by ...)
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions056.htm#i1000901
Nicolas. -
Please need help with this query
Hi !
Please need help with this query:
Needs to show (in cases of more than 1 loan offer) the latest create_date one time.
Meaning, In cases the USER_ID, LOAN_ID, CREATE_DATE are the same need to show only the latest, Thanks!!!
select distinct a.id,
create_date,
a.loanid,
a.rate,
a.pays,
a.gracetime,
a.emailtosend,
d.first_name,
d.last_name,
a.user_id
from CLAL_LOANCALC_DET a,
loan_Calculator b,
bv_user_profile c,
bv_mr_user_profile d
where b.loanid = a.loanid
and c.NET_USER_NO = a.resp_id
and d.user_id = c.user_id
and a.is_partner is null
and a.create_date between
TO_DATE('6/3/2008 01:00:00', 'DD/MM/YY HH24:MI:SS') and
TO_DATE('27/3/2008 23:59:00', 'DD/MM/YY HH24:MI:SS')
order by a.create_datePerhaps something like this...
select id, create_date, loanid, rate, pays, gracetime, emailtosend, first_name, last_name, user_id
from (
select distinct a.id,
create_date,
a.loanid,
a.rate,
a.pays,
a.gracetime,
a.emailtosend,
d.first_name,
d.last_name,
a.user_id,
max(create_date) over (partition by a.user_id, a.loadid) as max_create_date
from CLAL_LOANCALC_DET a,
loan_Calculator b,
bv_user_profile c,
bv_mr_user_profile d
where b.loanid = a.loanid
and c.NET_USER_NO = a.resp_id
and d.user_id = c.user_id
and a.is_partner is null
and a.create_date between
TO_DATE('6/3/2008 01:00:00', 'DD/MM/YY HH24:MI:SS') and
TO_DATE('27/3/2008 23:59:00', 'DD/MM/YY HH24:MI:SS')
where create_date = max_create_date
order by create_date -
Hi everyone...
I need help with this query. The table 'cobros' has a primary key defined by id_cliente + id_cobro. I pretend to classify rows by COUNT(id_cobro) which are between a date range.
A client could have 1 or 2 or 3 rows per day, no more for a specific date. I would like to get first, all clients with COUNT(id_cobro) = 1, all clients with COUNT(id_cobro) = 2, and finally all clients with COUNT(id_cobro) = 3.
Something similar to:
1 SELECT id_cliente, COUNT(id_cobro) FROM cobros
2 WHERE fecha_proximo_cobro >= '2011-05-30 00:00'
3 AND fecha_proximo_cobro <= '2011-05-30 23:59'
4 AND COUNT(id_cobro) = 1
5 GROUP BY id_cliente
The fourth line is the problem. It doesn't work.
Thanks in advance!!!
MarioMaybe you are looking for something like this?
SELECT id_cliente
, COUNT(*) AS cnt
FROM cobros
WHERE fecha_promixo_cobro BETWEEN TO_DATE('2011-05-30 00:00','YYYY-MM-DD HH24:MI') AND TO_DATE('2011-05-30 23:59','YYYY-MM-DD HH24:MI')
GROUP BY id_cliente
ORDER BY 2
, 1Also, NEVER rely on implicit data type conversion as you have (you provide a STRING not a DATE).
Edited by: Centinul on Jun 2, 2011 12:36 PM
Fixed syntax error. -
How to convert an sql query into a recordset?
HI, I'm having a hard time building a locations of service form for users to insert, update the cities, counties, zip codes based on the states selected.
so I found this query that works great if I use basic menus and text boxes, but can't use to make comma separated menus because it is nat a record set.
The problem is that I have a table called zip_codes, with the following fields: state_label, Zip_b, county, city.
zip codes correspond to the cities, counties and states.
example:
Colorado, Colorado Springs, El Paso, 80918
Users make a selection of state or states and the recordset is filtered by user selection.
I manage the part of making a select mutiple drop menu that passes the values to my query page like this.
<form action="litsTA.php"; method="post">
<h3>Choose State(s)</h3>
<p>hold Control key to select multiple states</p>
<select name="States_served[]_<?php echo $cnt1; ?>" multiple="multiple" onchange='showselection()'>
<?php
do {
?>
<option value="<?php echo $row_state['state_label']?>"><?php echo $row_state['state_label']?></option>
<?php
} while ($row_state = mysql_fetch_assoc($state));
$rows = mysql_num_rows($state);
if($rows > 0) {
mysql_data_seek($state, 0);
$row_state = mysql_fetch_assoc($state);
?>
</select>
<p>
<input type="submit" value="submit" />
</p>
</form>
And the query I need to convert into a recordset looks like this
mysql_select_db($database_duitop, $duitop);
$query_TONY = "SELECT * FROM zip_code WHERE state_label IN (";
for ($i=0; $i<=count($state_list)-1; $i++) {
//echo $state_list[$i];
$query_TONY = $query_TONY . "'" . $state_list[$i] . "'";
if ($i < count($state_list)-1) {
$query_TONY = $query_TONY . ", ";
$query_TONY = $query_TONY . ") GROUP BY county ORDER BY state_label, city ASC";
Any way that was my attempt to converting the query into a recordset.
any help, or samples will be appreciated.Use Tcode SQ01.
Give the query name press Enter.
The query will be listed in the table below.
Select the Query => From the Main menu select QUERY => More Functions => Display Report Name.
You will get the program name, now go to Se38 and display the program... -
Need help with conditional query
guys this is just an extension of this post that Frank was helping me with. im reposting because my requirements have changes slightly and im having a hell of a time trying to modify the query.
here is the previous post.
need help with query that can look data back please help.
CREATE TABLE "FGL"
"FGL_GRNT_CODE" VARCHAR2(60),
"FGL_FUND_CODE" VARCHAR2(60),
"FGL_ACCT_CODE" VARCHAR2(60),
"FGL_ORGN_CODE" VARCHAR2(60),
"FGL_PROG_CODE" VARCHAR2(60),
"FGL_GRNT_YEAR" VARCHAR2(60),
"FGL_PERIOD" VARCHAR2(60),
"FGL_BUDGET" VARCHAR2(60)
)data
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','11','00','400');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','1','100');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','1','0');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','11','1','400');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('360055','360055','7200','4730','02','10','1','400');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('360055','360055','7600','4730','02','10','1','400');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','14','200');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','10','14','100');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','14','200');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','2','100');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','11','2','600');
I need to find the greatest grant year for the grant by a period parameter.
once i find the greatest year i need to check the value of period 14 for that grant for the previous year and add it to the budget amount for that grant. however if their is an entry in the greatest year for period 00 then i need to ignore the period 14 of previous year and do this calculation current period +(current period - greatest year 00)
hope that makes sense so in other words with the new data above. if i was querying period two of grant year 11. i would end up with $800
because the greatest year is 11 it contains a period 0 with amount of $400 so my total should be
period 2 amount $ 600
period 0 amount $ 400 - period 2 amount of $600 = 200
600+200 = $800
if i query period 1 of grant 360055 i would just end up with 800 of grnt year 10.
i have tried to modify that query you supplied to me with no luck. I have tried for several day but im embarrased to say i just can get it to do what im trying to do .
can you please help me out.
here is the query supplied by frank kulash who gracefully put this together for me.
WITH got_greatest_year AS
SELECT fgl.* -- or whatever columns are needed
, MAX ( CASE
WHEN fgl_period = :given_period
THEN fgl_grnt_year
END
) OVER () AS greatest_year
FROM fgl
SELECT SUM (fgl_budget) AS total_budget -- or SELECT *
FROM got_greatest_year
WHERE ( fgl_grnt_year = greatest_year
AND fgl_period = :given_period
OR ( fgl_grnt_year = greatest_year - 1
AND fgl_period = 14
;MiguelHi, Miguel,
Are you waying that, when the greatest year that has :given_period also has period='00' (or '0', or whatever you want to use), then you want to double the budget from the given_period (as well as subtract the budget from the '00', and not count the pevious year's '14')? If so, add another condition to the CASE statement which decides what you're SUMming:
WITH got_greatest_year AS
SELECT TO_NUMBER (fgl_grnt_year) AS grnt_year
, fgl_period
, TO_NUMBER (fgl_budget) AS budget
, MAX ( CASE
WHEN fgl_period = :given_period
THEN TO_NUMBER (fgl_grnt_year)
END
) OVER () AS greatest_year
FROM fgl
, got_cnt_00 AS
SELECT grnt_year
, fgl_period
, budget
, greatest_year
, COUNT ( CASE
WHEN grnt_year = greatest_year
AND fgl_period = '00'
THEN 1
END
) OVER () AS cnt_00
FROM got_greatest_year
SELECT SUM ( CASE
WHEN grnt_year = greatest_year -- New
AND fgl_period = :given_period -- New
AND cnt_00 > 0 THEN budget * 2 -- New
WHEN grnt_year = greatest_year
AND fgl_period = :given_period THEN budget
WHEN grnt_year = greatest_year
AND fgl_period = '00' THEN -budget
WHEN grnt_year = greatest_year - 1
AND fgl_period = '14'
AND cnt_00 = 0 THEN budget
END
) AS total_budget
FROM got_cnt_00
;You'll notice this is the same as the previous query I posted, except for 3 lines maked "New". -
Hello,
I am using oracle 9i and windows XP:
Please help me to making a query to get output as mentioned below:
create table myt(col1 varchar2(10));
insert into myt values('TABLE1');
insert into myt values('TABLE2');
insert into myt values('TABLE3');
COMMIT;
create table table1(name varchar2(10),amount number);
create table table2(name varchar2(10),amount number);
create table table3(name varchar2(10),amount number);
insert into table1 values('James',1000);
insert into table1 values('David',1500);
insert into table1 values('James',2000);
insert into table1 values('David',1735);
insert into table2 values('Menon',500);
insert into table2 values('Martin',700);
COMMIT;
Required Output:
Table Name
Table1
James: 3000
David: 3235
Sum: 6235
Table2
Menon: 500
Martin: 700
Sum: 1200
-------RegardsIn your solution i added some modifications and got the output:
declare
cr_lf varchar2(2) := chr(13) || chr(10);
the_cursor sys_refcursor;
the_sql varchar2(4000) := 'select * from ' || cr_lf || '(' || cr_lf;
a_table varchar2(10);
ln varchar2(10);
a_name varchar2(10);
an_amount number:=0;
tan_amt number:=0;
i number;
j varchar2(4000);
begin
for the_row in (select col1 from myt) loop
the_sql := the_sql || 'select ''' || the_row.col1 || ''',name,sum(amount) from ' || the_row.col1 || ' group by name ' || cr_lf;
the_sql := the_sql || 'union all' || cr_lf;
end loop;
the_sql := substr(the_sql,1,length(the_sql) - 11) || ')' || cr_lf;
i := 1;
j := instr(the_sql,cr_lf,i);
while i > 0 loop
exit when j = 0;
dbms_output.put_line(substr(the_sql,i,j - i));
i := j + 2;
j := instr(the_sql,cr_lf,i);
end loop;
dbms_output.put_line(substr(the_sql,i));
--dbms_output.put_line(the_sql);
open the_cursor for the_sql;
dbms_output.put_line('--------------------------------------------------------------------------');
dbms_output.put_line(rpad('TABLE',20) || ' ' || rpad('NAME',20) || ' ' || rpad('AMOUNT',20));
dbms_output.put_line('--------------------------------------------------------------------------');
loop
ln:= a_table;
fetch the_cursor into a_table,a_name,an_amount;
exit when the_cursor%notfound;
if ln<>a_table then
dbms_output.put_line('--------------------------------------------------------------------------');
dbms_output.put_line(rpad('SUM',40) || lpad(to_char(tan_amt),10));
dbms_output.put_line('--------------------------------------------------------------------------');
tan_amt:=0;
end if;
tan_amt:= tan_amt+an_amount;
dbms_output.put_line(rpad(a_table,20) || ' ' || rpad(a_name,20) || ' ' || rpad(an_amount,20));
end loop;
dbms_output.put_line('--------------------------------------------------------------------------');
--dbms_output.put_line(rpad('SUM',45) || to_char(tan_amt));
dbms_output.put_line(rpad('SUM',40) || lpad(to_char(tan_amt),10));
dbms_output.put_line('--------------------------------------------------------------------------');
close the_cursor;
end;
select * from
select 'TABLE1',name,sum(amount) from TABLE1 group by name
union all
select 'TABLE2',name,sum(amount) from TABLE2 group by name
union all
select 'TABLE3',name,sum(amount) from TABLE3 group by name
TABLE NAME AMOUNT
TABLE1 David 6470
TABLE1 James 6000
SUM 12470
TABLE2 Martin 1400
TABLE2 Menon 1000
SUM 2400
--------------------------------------------------------------------------So many thanks for providing solution to me.
Regards -
Need helping in writing query for finding percentage of duration
Can any one please help in writing query for this.
The table is like this :-
ID Region Month Duration
I1 R1 Jan 80
I2 R2 Jan 70
I3 R1 Jan 70
I4 R3 Jan 40
I5 R1 Feb 80
I6 R2 Feb 30
I7 R3 Mar 100
I want to write a query to find
% of duration for each and every region against each and every month.
Please help in solving this query. I am in urgent need of this.
Thanks in advance.I also have to do in MS Access 2003You also have to ask into an other forum since here it's an Oracle forum, to try to find Oracle solution.
Nicolas. -
Hi
I need help to optimize the below query.... I takes to long to execute.
SELECT vbak~waerk
vbapvbeln vbapposnr
vbapnetwr vbapbrgew vbap~erdat
INTO CORRESPONDING FIELDS OF TABLE tmp_orders
FROM vbak INNER JOIN vbap ON vbakvbeln = vbapvbeln
WHERE vbap~matnr EQ t_mchb-matnr
AND vbap~netwr GT 0
AND vbap~brgew GT 1
AND vbak~auart IN ('ZCAO', 'ZDDO').
Please help...
Edited by: Alvaro Tejada Galindo on Mar 18, 2008 6:02 PMHi,
try this logic and see:
data: begin of itab_for_vbak occurs 0,
waerk type WAERK,
vbeln type vbeln,
end of itab_for_vbak,
wa_for_vbak like itab_for_vbak.
data: begin of itab_for_vbap occurs 0,
vbeln like vbap-VBELN,
posnr like vbap-POSNR,
netwr like vbap-NETWR,
brgew like vbap-brgew,
erdat like ERDAT
end of itab_for_vbap,
wa_for_vbap like itab_for_vbap.
SELECT
waerk
vbeln
from
vbak
into table itab_for_vbak
where
vbak~auart IN ('ZCAO', 'ZDDO').
select
vbeln
posnr
netwr
brgew
erdat
into table itab_for_vbap
where
vbap~matnr EQ t_mchb-matnr
AND vbap~netwr GT 0
AND vbap~brgew GT 1.
loop at itab_for_vbak into wa_for_vbak.
read table itab_for_vbap with key vbeln = wa_for_vbak-vbeln.
if sy-subrc eq 0.
tmp_orders-waerk = wa_for_vbak-waerk.
tmp_orders-vbeln = wa_for_vbap-vbeln.
tmp_orders-posnr = wa_for_vbap-posnr.
tmp_orders-brgew = wa_for_vbap-brgew.
tmp_orders-erdat = wa_for_vbap-erdat.
append tmp_orders.
endif.
endloop.
Please let me know how it has improved your performance or still if you have issues on this.
Thanks,
Vishnu. -
Hi.. need help with a query
hello guys :)
I need help with this exercise:
Find the most common cooking method in recipes that contain tomatoes.
the 4 tables:
t_recipes
--recipe_no
--recipe_name
t_products
--product_no
-product_name [tomatoes,cucumbers, onions]
t_integration
--product_no
--recipe_no
t_cooking_mode
recipe_no
mode [Frying,baking]
I am realy lost :S
thank youHi,
851072 wrote:
Thank you for your comment :)
But... I didn`t understand the first partSorry, what part is that? You probably understood "Welcome to the forum!" It looks like you understood most of what I said, perhaps before I said it. You seem to be on the right track.
Unlike talking to a co-worker in the next cube, exchanging messages with someone on this forum takes a fair amount of time, so it's worth the time it takes to explain things very clearly, more than you would in conversation. Post all the relevant information, and say exactly what the problem is.
amm i tried to do this:
select t_recipes.recipe_name, count(t_cooking_mode.cooking_mode)
from (t_cooking_mode INNER JOIN t_integration ON t_cooking_mode.recipe_no = t_integration.recipe_no )
INNER JOIN t_products ON t_integration.product_no = t_products.product_no)
WHERE t_products.product_name = 'tomatoes'
GROUP BY t_recipes.recipe_name
help?Please help by posting whatever you know about the problem. For example, if there's a error message, post the complete error message, including the line number.
Help the people who want to help you by formatting your code and making it easy to read and understand. This will help you, too.
For example, here's exactly what you posted, with only the white-space changed to make parallel items, such as parentheses, line up nicely:
select t_recipes.recipe_name
, count(t_cooking_mode.cooking_mode)
from ( t_cooking_mode
INNER JOIN t_integration ON t_cooking_mode.recipe_no = t_integration.recipe_no
INNER JOIN t_products ON t_integration.product_no = t_products.product_no
WHERE t_products.product_name = 'tomatoes'
GROUP BY t_recipes.recipe_nameWhen you format your code like this, it can be very easy to spot errors like unbalanced parentheses. In this case, the ')' right before the WHERE clause has no matching '('. You don't need to use any parentheses at all in the FROM clause. You can simply say:
FROM t_cooking_mode
JOIN t_integration ON t_cooking_mode.recipe_no = t_integration.recipe_no
JOIN t_products ON t_integration.product_no = t_products.product_no
WHERE ...INNER JOIN is the default kind of join, which makes sense, since the majority of all joins are inner joins. I usually say JOIN (instead of INNER JOIN) because it makes the code more compact and easier to read (at least for me), but I won't be maintaining your code, so do what's best for you.
What are you trying to find in this problem? Is it a recipe name or a cooking mode? If it's a cooking mode, the why do you have t_recipes.reciple_name in the SELECT (and GROUP BY) clause? Shouldn't you be using some other column, from some other table?
If I understand the problem correctly, the t_recipes table is not needed in this problem. You won't necessarily use every table in every query.
When you post formatted text on this site, type these 6 characters:
\(small letters only, inside curly brackets) before and after each section of formatted text, to preserve spacing.
Maybe you are looking for
-
System freezes after update w/ 'testing repo'
i'm using xfce with compiz and everything was fine til I updated my system with testing repo enabled.. here is my Xorg.conf # nvidia-settings: X configuration file generated by nvidia-settings # nvidia-settings: version 1.0 (buildmeister@builder3) We
-
Problem deploying ADF Faces component demo to Glassfish 3.1.2
Hi, Jdev 11.1.2.3 ADF Essentials Glassfish 3.1.2 Windows 7 (64-bit) Following the instructions on https://blogs.oracle.com/shay/entry/deploying_oracle_adf_applications_to I'm able to deploy and run a very simple ADF Faces application. But when I try
-
HOW TO USE SELECTION SCREEN I WANT TO INSERT PURCHASE DOCUMENT NUMBER AND WANT TO SEE ALL INFORMATION FOR THAT PURCHASE DOCUMNET NUMBER. THANKS IN ADVANCED.
-
I have a project which is 8 films about 20-30mins long. I am trying to export to iDVD and burn to one disk. With all 8 films exported, I am 0.8gb over the capacity of the disk. The films have been edited down as much as possible and I have exported t
-
InDesign CS5 Crashes on PDF Export if Suitcase Fusion 3 Auto Activation is on
I just started having a problem after upgrading from SF2 to 3 and using InDesign CS5. My exports to PDF were all crashing as soon as the PDF creation background process started. I tried all kinds of tests and troubleshooting to figure out what was