Variable in query SQL A?
Tags: NI Software
Similar Questions
-
problem with bind variables in the SQL query view object
Hi all
I use JDev 11.1.2.4.0.
I have a problem with bind variables in the SQL query view object.
This is my original SQL
SELECT sum(t.TIME) , t.legertype_id FROM LEDGER t WHERE t.nctuser_id = '20022' AND to_char(t.insertdate,'YYYYMMDD') in ('20130930','20130929') group by t.legertype_id
In my view .xml object query tab, I am writing this
SELECT sum(t.TIME) , t.legertype_id FROM LEDGER t WHERE t.nctuser_id = '20022' AND to_char(t.insertdate,'YYYYMMDD') in :dddd group by t.legertype_id
Davis here is a variable of Type liaison: String, updatable and necessary.
I try to deal with Davis as ('20130930 ', ' 20130929') hoping the view object, run as my original SQL.
But failed. The view object retrieves 0 line after that I run.
Why?
Thank you! ('2original SQL0130930', '20130929') ('20130930 ', ' 20130929')
A variable binding cannot be used as this is why you must use years table. Check decompilation binary ADF: using oracle.jbo.domain.Array with ViewCriteria to see a solution.
Timo
-
Hello OTN.
I don't understand why my sql query will pass by in the data model of the BI Publisher. I created a new data model, chose the data source and type of Standard SQL = SQL. I tried several databases and all the same error in BI Publisher, but the application works well in TOAD / SQL Developer. So, I think it might be something with my case so I'm tender hand to you to try and let me know if you get the same result as me.
The query is:
SELECT to_char (to_date ('15-' |)) TO_CHAR(:P_MONTH) | » -'|| (To_char(:P_YEAR), "YYYY-DD-MONTH") - 90, "YYYYMM") as yrmth FROM DUAL
Values of the variable:
: P_MONTH = APRIL
: P_YEAR = 2015
I tried multiple variations and not had much luck. Here are the other options I've tried:
WITH DATES AS
(
Select TO_NUMBER (decode (: P_MONTH, 'JANUARY', '01',))
'FEBRUARY', '02',.
'MARCH', '03'.
'APRIL', '04'
'MAY', '05'.
'JUNE', '06'.
'JULY', '07',.
'AUGUST', '08'.
'SEPTEMBER', '09'.
'OCTOBER', '10',.
'NOVEMBER', '11'.
"DECEMBER", "12."
'01')) as mth_nbr
of the double
)
SELECT to_char (to_date ('15-' |)) MTH_NBR | » -'|| (TO_CHAR(:P_YEAR), 'DD-MM-YYYY') - 90, "YYYYMM")
OF DATES
SELECT to_char (to_date ('15-' |: P_MONTH |)) » -'|| ((: P_YEAR, 'MONTH-DD-YYYY')-90, "YYYYMM") as yrmth FROM DUAL
I'm running out of ideas and I don't know why it does not work. If anyone has any suggestions or ideas, please let me know. I always mark answers correct and useful in my thread and I appreciate all your help.
Best regards
-Konrad
So I thought to it. It seems that there is a bug/lag between the guest screen that appears when you enter SQL in the data model and parameter values, to at model/value data.
Here's how I solved my problem.
I have created a new data model and first created all my settings required in the data model (including the default values without quotes, i.e. APRIL instead "Of APRIL") and then saved.
Then I stuck my sql query in the data model and when I clicked ok, I entered my string values in the message box with single quotes (i.e. "in APRIL' instead of APRIL)
After entering the values of string with single quotes in the dialog box, I was able to retrieve the columns in the data model and save.
In the data tab, is no longer, I had to enter the values in single quotes, but entered values normally instead, and the code worked.
It seems the box prompted to bind the values of the variables when the SQL text in a data model expects strings to be wrapped in single quotes, but no where else. It's a big headache for me, but I'm glad that I solved it, and I hope this can be of help to other institutions.
See you soon.
-
How to declare variables in PL/SQL (dynamically)
Hello
Please inform me how can I declare variables in PL/SQL dynamically (I want used in other projects). I tried the following code, but this error
SQL > /.
declare
*
ERROR on line 1:
ORA-06550: line 1, column 74:
PL/SQL: ORA-00933: SQL not correctly completed command
ORA-06550: line 1, column 35:
PL/SQL: SQL statement ignored
ORA-06512: at line 10
-----------------------------------------
This is the code.
declare
v_temp varchar2 (300);
x varchar2 (20);
y varchar2 (20);
Start
BBB: = "X varchar2 (20);"
y : = '1' ;
run immediately 'declare '.
|| v_temp
|| "start."
|| 'Select name '.
|| "Ali where id =: yy '.
|| ' x using the ' | There
|| ' ; '
|| ' end; ';
end;
concerning
WAeluser3098640 wrote:
Hi, thanks a lot for all. OK I'll show you that I want to achieve. So please help me
refer to the following table it consist of four columns and three rows.
I only want to show the column that has a value of ZERO : like the following querySelect REC1 IMAGE_VALUE where corr = 'x' and rec1 = '1';
Do you want that ZERO or '1 '? Contradict you yourself.
Good to see you're requirements are clear.
in this case are easy, but in my case the columns may be more than 100 columns (this is will automatically create - already made the number of columns is not fixed but it start by REC1 REC2, REC3, REC4... etc)
the question is How can I DISPLAY the columns containing only '1' for specfic "corr" is X, Y or Z in PL - SQLWhy you have a table that automatically creates with an unknown number of columns?
It of very bad database design and get the basics of the design by the window completely.When you say 'Show' to what it means? SQL and PL/SQL "shows" nothing, because it has no user interface. It simply processes the data, and if these data are not in a known structure at the time where the application has been designed, and all code must be dynamic to try to deal with it. It is simply false in many ways.
A better structure would be something like this...
SQL> create table image_value (corr varchar2(20), rec varchar2(10), rec_val varchar2(20)); Table created. SQL> SQL> insert into image_value (corr, rec, rec_val) values ('X','REC1','1'); 1 row created. SQL> insert into image_value (corr, rec, rec_val) values ('X','REC2','0'); 1 row created. SQL> insert into image_value (corr, rec, rec_val) values ('X','REC3','0'); 1 row created. SQL> insert into image_value (corr, rec, rec_val) values ('Y','REC1','0'); 1 row created. SQL> insert into image_value (corr, rec, rec_val) values ('Y','REC2','1'); 1 row created. SQL> insert into image_value (corr, rec, rec_val) values ('Y','REC3','1'); 1 row created. SQL> insert into image_value (corr, rec, rec_val) values ('Z','REC1','1'); 1 row created. SQL> insert into image_value (corr, rec, rec_val) values ('Z','REC2','0'); 1 row created. SQL> insert into image_value (corr, rec, rec_val) values ('Z','REC3','1'); 1 row created. SQL> SQL> commit; Commit complete. SQL> SQL> with r as (select '&Required_Corr' as req_corr from dual) 2 -- 3 -- end of input 4 -- 5 select corr 6 ,max(decode(rn,1,rec)) as c1 7 ,max(decode(rn,2,rec)) as c2 8 ,max(decode(rn,3,rec)) as c3 9 ,max(decode(rn,4,rec)) as c4 10 ,max(decode(rn,5,rec)) as c5 11 ,max(decode(rn,6,rec)) as c6 12 ,max(decode(rn,7,rec)) as c7 13 ,max(decode(rn,8,rec)) as c8 14 ,max(decode(rn,9,rec)) as c9 15 ,max(decode(rn,10,rec)) as c10 16 from ( 17 select corr, rec, row_number() over (partition by corr order by rec) as rn 18 from image_value, r 19 where corr = req_corr 20 and rec_val = '1' 21 ) 22 group by corr; Enter value for required_corr: X old 1: with r as (select '&Required_Corr' as req_corr from dual) new 1: with r as (select 'X' as req_corr from dual) CORR C1 C2 C3 C4 C5 C6 C7 C8 C9 C10 -------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- X REC1 SQL> / Enter value for required_corr: Y old 1: with r as (select '&Required_Corr' as req_corr from dual) new 1: with r as (select 'Y' as req_corr from dual) CORR C1 C2 C3 C4 C5 C6 C7 C8 C9 C10 -------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- Y REC2 REC3 SQL> / Enter value for required_corr: Z old 1: with r as (select '&Required_Corr' as req_corr from dual) new 1: with r as (select 'Z' as req_corr from dual) CORR C1 C2 C3 C4 C5 C6 C7 C8 C9 C10 -------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- Z REC1 REC3 SQL>
And you support the maximum number of values REC you expect.
Other than that, what you're really talking is a reporting requirement that requires that the data to be read once before, it is then processed and only the required data is queried with a second query. This can be done in PL/SQL using DBMS_SQL (or versions using EXECUTE IMMEDIATE), but really, that should be done by tools that are designed to query data then format and place based on the content of the reporting data.
Yet, you have not really explained why you are trying to do. It's alright saying you are trying to achieve, but which does not justify as being the right way to do things. What you have shown us so far, is not how to design a database or application code.
-
bind variables in pl/sql static
Hello world.
This feature will be works faster than the function below without binding? (I mean if he calls very often, and execution plan is in cache)FUNCTION get_amployee_name (empid INTEGER, empcity VARCHAR2) RETURN VARCHAR2 IS TYPE GenericCursor IS REF CURSOR; c1 GenericCursor; empname VARCHAR2(200); BEGIN OPEN c1 FOR SELECT ename FROM employees WHERE id = :id AND city = :city USING empid, empcity; FETCH c1 INTO empname; CLOSE c1; RETURN empname; END;
I tried to find info related to the execution of pl/sql query steps, but cannot. Optimizer does use the values of real variables in pl/sql to generate the exec. plan? Or it will be generated only once when the function performed the first time?FUNCTION get_amployee_name (empid INTEGER, empcity VARCHAR2) RETURN VARCHAR2 IS empname VARCHAR2(200); BEGIN SELECT ename into empname FROM employees WHERE id = empid AND city = empcity; RETURN empname; END;
Reference and discusses this in Chapter 1 PL/SQL user's Guide
http://download.Oracle.com/docs/CD/B19306_01/AppDev.102/b14261/overview.htm#sthref145
"When you embed an INSERT, UPDATE, DELETE or SELECT SQL statement directly in your PL/SQL code, PL/SQL transforms the variables in the WHERE clauses of the VALUES to automatically bind variables. Oracle can re-use these SQL statement every time the same code is executed. To execute statements similar with different values of variables, you can save the analysis of overhead by calling a stored procedure that accepts parameters, and then issues the declarations with the parameters substituted in the appropriate places. »
Justin
-
With the help of a number variable in a SQL statement
Hello
I am trying to use a variable in a sql statement, and I ran into problems when the variable is a number. The following line of code works if the variable is a string, but not if it is a number.
"SELECT PAGE 1 UUT_STATUS OF UNIT_UUT_RESULT WHERE UnitID = '" + Locals.LocalUnitID + "' ORDER BY DESC START_DATE_TIME.
Is there a difference in the use of single and double quotes and the sign for numbers variables +?
Thank you
Stuart
Jervin is almost correct in the post above.
While it is correct that numbers in SQL are not enclosed in single quotes ('), we still need the entire expression to a string. If Locals.LocalUnitID is stored as a number to TestStand, you will need to cast to a string so that the string concatination works properly.
I believe that the correct form is as follows:
"SELECT PAGE 1 UUT_STATUS OF UNIT_UUT_RESULT WHERE UnitID ="+ Str (Locals.LocalUnitID) + 'ORDER BY DESC START_DATE_TIME'
-
Please, help me to query SQL Construct.
Hi Experts,Could you please help me to query SQL Construct. Please find the details
HOSTNAME HOSTTYPE DEM R1 R2
RS123 P ABC 24.5 265,5RS123 P CYC 24.5 265,5
RS123 P ADDS 24.5 265,5
RS123 P ADE 24.5 265,5
RS123 P SRC 24.5 265,5
EXPECTED RESULTS
HOSTNAME HOSTTYPE MNE R1 R2
RS123 P ABC, CYC, ADD, ADE, CBC 24.5 265,5Concerning
See you soon
with t as)
Select "RS123' hostname 'P' hosttype, 'ABC' dem, 24.5 r1, r2 265,5 Union double all the
Select 'RS123', 'P', "CYC", 24.5, 265,5 double Union all
Select 'RS123', 'P', 'ADD', 24.5, 265,5 double Union all
Select "RS123', 'P', 'ADE', 24.5, 265,5 double Union all
Select 'RS123', 'P', 'SRC', 24.5, 265,5 double
)
Select the host name,
HostType,
RTrim (XMLAGG (XmlElement(e,MNE,','). (Extract ('//Text ()')), ',') DEM,.
R1,
R2
t
Group hostname,
HostType,
R1,
R2
/
HOSTN H DEM R1 R2
----- - -------------------- ---------- ----------
RS123 P ABC, CBC, ADE, ADD, CYC 24.5 265,5SQL >
SY.
-
Create a simple query (SQL)
Hi experts,
I have a table with data as follows:
Database version: 10.2.0.4
Table name: TRANSACTION_HIST_TAB
and I want to create a single query (SQL) which can get data grouped by LOT_NO and only the first transaction by LOT_NOTRANS_ID LOT_NO PART_NO QTY TRANSACTION LOCATION_NO ROWVERSION --------- ------- -------- ---- ----------------- ------------ ---------------------- T00000X1 L001 ABC 10 CHANGE LOCATION WRH_1 01/01/13 08:00:00 AM T00000X2 L001 ABC 10 CHANGE LOCATION WRH_2 01/02/13 10:00:00 AM T00000X3 L002 XYZ 20 CHANGE LOCATION WRH_3 01/03/13 11:00:00 AM
Expected results:
Someone has an idea?TRANS_ID LOT_NO PART_NO QTY TRANSACTION LOCATION_NO ROWVERSION --------- ------- -------- ---- ----------------- ------------ ---------------------- T00000X1 L001 ABC 10 CHANGE LOCATION WRH_1 01/01/13 08:00:00 AM T00000X3 L002 XYZ 20 CHANGE LOCATION WRH_3 01/03/13 11:00:00 AM
Kind regards
RobHi, Rob.
Here's one way:
WITH got_r_num AS ( SELECT t.* -- or list columns you want , ROW_NUMBER () OVER ( PARTITION BY lot_no ORDER BY rowversion ) AS r_num FROM transaction_hist_tab t ) SELECT * -- or list all columns except r_num FROM got_r_num WHERE r_num = 1 ;
Depending on your data and your needs, match Sub like Manik suggested, might work. I think that you want to GROUP BY lot_no only, no transid.
I hope that answers your question.
If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements), and the results you want from this data.
Explain, using specific examples, how you get these results from these data.
Always say what version of Oracle you are using (for example, 11.2.0.2.0).
See the FAQ forum {message identifier: = 9360002} -
query sql delicate... date of the created object.
friends...
I am trying to solve this query sql delicate for some time, but unable to progress when it comes to this day...
Q.
Query dba_objects and list all tables created yesterday ' sysdate - 1' and in another column of the list all the tables created ' sysdate - 7'.
-query below gives me to yesterday, but don't know how to have 'Last_week' column filled... maybe I join?
appreciate your time and effort in looking at this...select owner, object_name, to_char(created, 'MM-DD-YYYY HH24:MI:SS') "Yesterday", to_char(created, 'MM-DD-YYYY HH24:MI:SS') "Last_Week" from dba_objects where object_type = 'TABLE' and created >=trunc(sysdate - 1) and created < trunc(sysdate)
Thank you
Published by: khallas301 on March 19, 2013 09:27
typo edited... Thanks to frankkhallas301 wrote:
Query dba_objects and list all tables created yesterday ' sysdate - 1' and in another column of the list all the tables created ' sysdate - 7'.Well, sysdate - 7 ways months ago, not last week. If this is what you want, then:
select owner, object_name, case when trunc(created) = trunc(sysdate - 1) then to_char(created,'MM-DD-YYYY HH24:MI:SS') end "Yesterday", case when trunc(created) = trunc(sysdate - 7) then to_char(created, 'MM-DD-YYYY HH24:MI:SS') end "Week Ago" from dba_objects where object_type = 'TABLE' and ( trunc(created) = trunc(sysdate - 1) or trunc(created) = trunc(sysdate - 7) ) /
SY.
-
Get the bind variables name string SQL or the cursor
Hello
Is there way to get of the bind variables name string SQL or the cursor?
Example of
What I mean with the SQL string:DECLARE l_sql VARCHAR2(2000); desctab DBMS_SQL.DESC_TAB; curid PLS_INTEGER; BEGIN l_sql := 'SELECT * FROM emp WHERE mgr = :X and deptno = :Y'; curid := dbms_sql.open_cursor; dbms_sql.parse(curid, l_sql, dbms_sql.NATIVE); .... END;
I love to get using some functions from above code variable l_sql all the bind variable.
In this case the function should return array where is for example: X and: Y
Back to bind the cursor variable names, I mean same but rather string I pass number of cursor.
Y at - it sucks ready function or some may share a code customized for this purpose?
Thanks
Kind regards
Jari
http://dbswh.webhop.NET/dbswh/f?p=blog:Home:0Regards,
Published by: jarola December 19, 2011 02:44
I found there are wwv_flow_utilities.get_binds of the function not documented in APEX packages that do what I want.
Usage example
But I would not use these functions without papers as those who can change or there is no future versions APEX.set serveroutput on DECLARE binds DBMS_SQL.varchar2_table; BEGIN binds := wwv_flow_utilities.get_binds('select :P1_TEST from dual'); FOR i IN 1 .. binds.count LOOP dbms_output.put_line(binds(i)); END LOOP; END; / anonymous block completed :P1_TEST
Is there a documented function or the custom function that do the same thing as wwv_flow_utilities.get_binds?Some old basic example code of my friends. Also the media getting the bind variable of PL/SQL code blocks anon.
SQL> create or replace function GetBindVariables( statement varchar2 ) return TStrings is 2 --// bind variables names are terminated by one the following special chars 3 SPECIAL_CHAR constant TStrings := TStrings(' ',')','+','-','>','<','*',',','=',';',CHR(10),CHR(13)); 4 5 --// max size of a bind var name 6 MAX_VARSIZE constant integer := 100; 7 8 pos integer; 9 pos1 integer; 10 occur integer; 11 varName varchar2(100); 12 varList TStrings; 13 begin 14 varList := new TStrings(); 15 16 --// looking for the 1st occurance of a bind variable 17 occur := 1; 18 19 loop 20 pos := InStr( statement, ':', 1, occur ); 21 exit when pos = 0; 22 23 varName := SubStr( statement, pos, 100 ); 24 25 --// find the terminating char trailing the 26 --// bind variable name 27 pos1 := Length( varName ); 28 for i in 1..SPECIAL_CHAR.Count 29 loop 30 pos := InStr( varName, SPECIAL_CHAR(i) ) - 1; 31 if (pos > 0) and (pos < pos1) then 32 pos1 := pos; 33 end if; 34 end loop; 35 36 --// extract the actual bind var name (without 37 --// colon char prefix) 38 varName := SubStr( varName, 2, pos1-1 ); 39 40 --// maintain a unique list of var names 41 if not varName member of varList then 42 varList.Extend(1); 43 varList( varList.Count ) := varName; 44 end if; 45 46 --// look for the next occurance 47 occur := occur + 1; 48 end loop; 49 50 return( varList ); 51 end; 52 / Function created. SQL> SQL> select 2 column_value as BIND_VAR 3 from TABLE( 4 GetBindVariables('select * from foo where col=:BIND1 and day = to_date(:B2,''yyyy/mm/dd'')') 5 ); BIND_VAR ------------------------------ BIND1 B2 SQL>
PS. just realize this code is case-sensitive, while variable bind is not. Should throw a upper() or lower() by adding the name of the var to the list - never really a problem for me because I'm pretty tense when it use cases correctly in the code. ;-)
Published by: Billy Verreynne, December 19, 2011 06:19
-
Query SQL Report with condition (multiple settings) at the point of the apex?
Hi all
I have a small problem and cannot find a solution.
I need to create reports based on a query, SQL or I.R. Nothing hard here.
I need to add the WHERE clause dynamically with javascript to an element of the Apex.
Even once is not very difficult. I set the agenda of the Summit, put my query like this "SELECT * FROM MYTAB WHERE COL1 =: P1_SEARCH" then I call the page by setting the P1_SEARCH value. For example, COL1 is rowid. It works very well.
But here's my problem. Consider that P1_SEARCH contains several ROWID, and I don't know the number of these values,
(no I don't create a large number of items and create a query with so much GOLD!), I would sotheming like "SELECT * FROM MYTAB WHERE ROWID IN (: P1_SEARCH) with something like: ROWID1, ROWID2 in P1_SEARCH."
I also tried: 'ROWID1, ROWID2' and 'ROWID1', 'ROWID2 '.
but I can't get anything else than the mistake of filter. It works with a value, but as soon as there are two values or more, it seems that the Apex is unable to read the string.
How can I do it please?
Thanks for your help.
Maxmnoscars wrote:
But here's my problem. Consider that P1_SEARCH contains several ROWID, and I don't know the number of these values,
(no I don't create a large number of items and create a query with so much GOLD!), I would sotheming like "SELECT * FROM MYTAB WHERE ROWID IN (: P1_SEARCH) with something like: ROWID1, ROWID2 in P1_SEARCH."I also tried: 'ROWID1, ROWID2' and 'ROWID1', 'ROWID2 '.
but I can't get anything else than the mistake of filter. It works with a value, but as soon as there are two values or more, it seems that the Apex is unable to read the string.For a standard report, see + {message identifier: = 9609120} +.
For an IR - and improve safety by avoiding the risk of SQL Injection, use a collection containing the values in a column instead of a CSV list:
{code}
SELECT * FROM MYTAB WHERE ROWID IN (SELECT c001 FROM apex_collections WHERE collection_name = "P1_SEARCH")
{code}
(Please close duplicate threads spawned by your original question.) -
Validation of a region defined as a QUERY SQL type (updated report)
Hello
I am trying to perform validation on a region defined as type of QUERY SQL (editable report). The report has two columns.
One of the columns is a Select list and I want to make sure that the user can select the same value twice
in the report. For example, if the selection list has 5 values A, B, C, D, E, I don't want a user to be able to select
B twice in the report. Will it use javascript to perform validation? If Yes, could someone provide some guidance on
where to embed the javascript? Are there other alternatives than javascript? I create an element that came from a sql query
counts the number of lines where the value of the column is the same. I then used the item in my validation logic. The problem with this logic
is that a user can enter the same value and it is not until the 3rd attempt to select the same value that the validation works using the number of lines which is why I think that I need to somehow capture the value of the selection list when a user selects and then compare it to what is already in the database column Select.
I hope that my question and explanations are clear.
Thanks in advance for your help,
MichaelHello
This can be managed using javascript or a validation of the page. Here is an example of use of javascript: [http://htmldb.oracle.com/pls/otn/f?p=267:7]
To do this, I have:
1 - a model of button which does not send the page but just runs javascript. The model will depend on your theme, but should include:
<a href="#BUTTON_ATTRIBUTES#">#LABEL#</a>
If #BUTTON_ATTRIBUTES # appears on the template, delete it as we need it only once. You must create a new button model based on a copy of your existing across models, shared components. Normally, he would show href = "" #LINK # "-we do not want that this would become doSubmit('buttonname')." If your model does not use tags for buttons, you might need to create one from scratch.
2 - I have updated the button on my page to use this template and then assign the setting button attributes:
javascript:check();
3. in the header of the HTML page, I added:
<script type="text/javascript"> function check() { var e = 0; var f = document.getElementsByName("f02"); var k1; var k2; var v1; var v2; if (f) { for (k1 = 0; k1 < (f.length - 1); k1++) { v1 = f[k1].value; for (k2 = (k1 + 1); k2 < f.length; k2++) { v2 = f[k2].value; if (v1 == v2) { e = 1; } } } } if (e > 0) { alert("Duplicates found!"); } else { doSubmit("SUBMIT"); } } </script>
In this example, SUBMIT is the name of the button and "f02" is the name attribute of the select list items that we want to check - change these needs by your page.
Now, when the Submit button is clicked, instead of directly submit the page, the javascript function is called. This function loops through each selection list and gets its value. Then, he compared it to the remaining items. If there is a match, the e flag is set to 1. After all the items have been verified, if e is not 0, then a message appears. Otherwise, the page is sent.
Andy
-
Need help with query SQL Inline views + Group
Hello gurus,
I would really appreciate your time and effort on this application. I have the following data set.
Reference_No---Check_Number---Check_Date---description---Invoice_Number---Invoice_Type---Paid_Amount---Vendor_Number
1234567 11223 - 05/07/2008 -paid for cleaning- 44345563-I-* 20.00 *---19
1234567 11223 - 05/07/2008 - 44345563 -a--10,00---19 ofbad quality adjustment
7654321 11223 - 05/07/2008 - setting the last billing cycle - 23543556 - A - 50.00 - 19
4653456 11223 - 05/07/2008 - paid for cleaning - 35654765 - I - 30, 00-19
Please ignore '-' added for clarity
I'm writing a paid_amount based on Reference_No, Check_Number, Payment_Date, Invoice_Number, aggregate query 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_Type, Invoice_Number, Vendor_Number. When there are no more 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 - 05/07/2008 -paid for cleaning- 44345563-I-* 10.00 *---19
7654321 11223 - 05/07/2008 - setting the last billing cycle - 23543556 - A - 50.00 - 19
4653456 11223 - 05/07/2008 - paid for cleaning - 35654765 - I - 30, 00-19
Here's my query. I'm a little lost.
Select b., A.sequence_id, A.check_date, A.check_number, A.invoice_number, A.amount, A.vendor_number
de)
Select sequence_id, check_number, check_date, invoice_number, sum (paid_amount) sum, vendor_number
of the INVOICE
Sequence_id group check_date, check_number, invoice_number, vendor_number
) A, B OF INVOICE
where A.sequence_id = B.sequence_id
Thank you
NickIt seems that this is a duplicate thread - correct me if I am wrong in this case->
Need help with query SQL Inline views + Group
Kind regards.
LOULOU.
-
Weird error Substitution of variables in a SQL query
I'm about to finish an application but a single error goofy throws me a loop for. Error complains my SQL syntax on the line containing "#filelist_sql #" near the bottom of the application, but when I exit the SQL and execute it in phpMyAdmin, it works very well.
Thanks in advance for any help provided. I think I was just watching this way too long.
Code follows:
Just for fun, put these variables inside a function preservesinglequotes sql and see if that helps.
-
How can I use variable presentation logic SQL
Hi Experts,
How can I use variable SQL logical presentation. I need the exact syntax. Kindly help me to achieve this goal.
"Time". "" Date "between the Date of 2014 '-1-17 'and Date' ' 2014-2-16
Thanks in advance
Asim
It's done... We can use it in the logical query with the same syntax where we use in converting this filter as SQL...
Maybe you are looking for
-
email has expired and I forgot security issues
Hello I have 2 problems: 1. to register my account, I have an alternative email address. the problem is that email is now expired before that I could change... 2. I've forgotten my security questions Together this makes the problem: I can not change
-
I recently bought this laptop from a friend and she has never had this problem and ive trawled through microsofts suggestions, which most need of the start bar, which I did not immediately because of the blackscreen, and start on the keyboard key is
-
Cannot install mouse wireless 6000 X traveler
I bought a 6000 X model GM100021/T traveller wireless mouse, but the mouse settles not on my computer. He said HID class device driver facility is absent because INF WAS WRITTEN FOR Windows 95 OR LATER version I use WINDOWS XP WITH SERVICE PACK 3 TEA
-
original title: handwriting recognition several users I'll try to find out how Windows Vista Enterprise SP1 running on a tablet of 2730p HP will react to several user accounts and its handwriting recognition software will react. It keeps all users w
-
Should what drivers I for any new installation
Hi all: I have X 220 I want to clean install windows 7 pro During installation, I am asked to insert a CD/DVD driver and I don't have it. I intend to download the drivers from lenovo Web site. But there are so many pilots, that one would be sufficien