SQL Newbie help
The following query works fine but I need to do the same thing but this time by using a join explicitly.Select Departments.Deptnumber, Departments.name,
sum (quantity)
from SalesOrderItems, departments
where Departments.Deptnumber = SalesOrderItems.DeptNumber
Departments.Deptnumber group, Departments.name;
I tried
Select Departments.Deptnumber, Departments.name,
sum (quantity)
INNER JOIN SalesOrderItems ministries
ON Departments.Deptnumber = SalesOrderItems.DeptNumber
order of Departments.Deptnumber, Departments.name;
but get the error
ERROR at line 3:
ORA-00933: SQL not correctly completed command.
any help will be great thank you.
What version of Oracle are you using?
SELECT * FROM v$version
ANSI style joins are available with version 9. ? and at the top
John
Tags: Database
Similar Questions
-
SQL Query help find albums from sale
Hi Experts,
I have the following data and the need to find the book Top sold in each type.
Book Type QTY
20 Help the 3 10 Kitchen 1 5 Navigation 2 30 Help the 4 Please let me how can know we get this simple SQL help?
Thank you
Bharat
Hello
Bharat Hegde wrote:
Hi all
I tried to use Dense_rank as below. But it gives me the top selling books. I need high library in each type...
This looks like a job for 'PARTITION BY type
For example:
WITH got_rnk AS
(
SELECT b.bid, b.type
SUM (o.quantity) AS total_quantity
DENSE_RANK () OVER ( PARTITION BY b.type
ORDER OF SUM (o.quantity) / / DESC
) AS rnk
B BOOK
o order1
WHERE b.bid = o.bid
GROUP BY b.bid, b.type
)
SELECT total_quantity, type submission
OF got_rnk
WHERE rnk = 1
;
. Aggregate functions (such as the SUM, above) are calculated before analytical functions, so an analytic function (such as DENSE_RANK above) may depend on an aggregate function; you don't need a separate subquery for that.
-
Dear friends,
Version of DB - 11.1.0.7... , I'm stuck with SQL basics today... need your help...
The slot SQL tells me "cache them locks library" in the database that I will put up as a proactive measure.
I'll be it works via shell script and include the table gv instance_name $ instance ... I'm a little confused as to how a 3rd table "gv$ instance ' can be introduced into the query in order to make the instance_name in the result set...
SELECT * FROM)
SELECT / * + LEADING (a) USE_HASH (u) * /.
instance_name, INST_ID select, blocking_inst_id, blocking_session, username, session_id, sql_id, current_obj #,.
DECODE (sql_opcode, 1, 'CREATE TABLE', 2, 'INSERT') as "order."
Event, mod(P1,16) p1, p2, p3
COUNT (*) totalseconds
, SUM (CASE WHEN wait_class = 'Application' THEN 1 ELSE 0 END) 'Application '.
Of
(SELECT
a.*
, TO_CHAR (CASE WHEN session_state = 'WAITING' THEN ELSE null END p1, '0XXXXXXXXXXXXXXX') p1hex
, TO_CHAR (CASE WHEN session_state = "PENDING" THEN p2 ELSE null END, '0XXXXXXXXXXXXXXX') p2hex
, TO_CHAR (CASE WHEN session_state = "PENDING" THEN ELSE null END p3, '0XXXXXXXXXXXXXXX') p3hex
SGS $ active_session_history one) a
u dba_users
WHERE
a.user_id = u.user_id
AND sample_time BETWEEN sysdate-90 /(24*60) AND sysdate
- AND a test of ('library cache lock', 'library cache pin")
AND event like '% library '.
GROUP BY
INST_ID select, blocking_inst_id, blocking_session, username, session_id, sql_id, current_obj #,.
DECODE (sql_opcode, 1, 'CREATE TABLE', 'INSERT', 2),
event, mod (p1, 16), p2, p3
Having count (*) > 5
ORDER BY
TotalSeconds DESC
, INST_ID select, blocking_session, username, session_id, sql_id, current_obj #, 'Order', event
)
WHERE
ROWNUM < = 20
/
replace
instance_name
by
(select instance_name gv$ instance where INST_ID select = a.inst_id) instance_name
or select... in... a, u, gv$ instance where... and gv$ instance.inst_id (+) = a.inst_id...
-
SQL - select Help - box When? Return value of the second Table?
-Next to people on this forum I am probably somewhere between a beginner and an intermediate SQL user.
Ive been using a case when stated in plsql to find "all who has status in any program was canceled during a specific time, but have become or are still active in another program"
So, Im actually trying to return a value from another table in a case where, but this isn't anthing taste other than a text declared as 'Yes' or 'no '.
This is the select statement - y at - it another way to do it where I can get the results I need?
-case when pp.party_id in (select pp1.party_id - cancelled active clients in another program)
of asa.program_participation pp1,.
ASA.curr_prog_participation_status cpps1
where pp1.program_participation_id = cpps1.program_participation_id
and pp1.party_id = pp.party_id
and cpps1.code_value = 'Act')
So 'Yes' is still 'No' end as Active_in_Other_Prg
So - instead of 'Yes', I want essentially the program they are active or pp1.program_id, another null
It is possible that the client can be active in more than one program as well.
Any help is greatly appreciated, I explored with if and decodes but I can't get anything to work.
Ben
Looks like an outer join. See doc ora: joins at
Select p
q.party_id
q.program_id
of table_with_party_id p
, (select pp1.party_id - cancelled active clients in another program)
pp1.program_id
of asa.program_participation pp1,.
ASA.curr_prog_participation_status cpps1
where pp1.program_participation_id = cpps1.program_participation_id
and pp1.party_id = pp.party_id
and cpps1.code_value = 'ACT') q
where p.party_id = q.party_id (+)
Note: In the example above shoudn't it be a space between the (and +), but the forum software automatically converts to
The outer join will connect display all records in the table p and q records only if fits the party_id, IE q.party_id and q.program_id will be null if there is no match.
Edit: adding program_id
-
Dear Experts,
I need help, writing / editing PL/SQL procedure below. My task is to rebuild indexes on tables that were not rebuilt during the last 24 hours. The "select" statement of down gives me the list of all the names of tables whose indexes are not rebuilt in last 24 hours (maint.index_rebuild is a custom table, we built to capture the rebuild index timings).
maint.online_reorg procedure done index rebuild. I need this procedure to run on all tables (returned by the select statement). How can I get the modified procedure to get what I'm looking for below. Enjoy your entries.
declare cursor c1 is select distinct table_name from maint.index_rebuild where start_time <= SYSDATE-1; begin for i in c1 loop maint.online_reorg('OWNER','table name from cursor result set'); end loop; end; /
declare cursor c1 is select distinct table_name from maint.index_rebuild where start_time <= SYSDATE-1; begin for i in c1 loop maint.online_reorg('OWNER',i.table_name); end loop; end;
will do what you ask. As others have pointed out, however, what you're trying to do is strongly discouraged. Reconstruction of each index everyday is going to generate a huge amount of load on your database for no benefit and creates a number of opportunities to introduce errors.
Justin
-
I'm just having a bit of troubel get a correct join query - I thought it was an Inner Join, but I don't get the results I expect.
My table structure is:
Table: lodges
LodgeID (PK)
Lodge
etc.
Table: implemented application
NominationID (PK)
Category
LodgeID
Year
So I try to use this structure to replicate this page:
http://www.safariawards.com/nominees12/
That is to say a list of boxes for each category, they are appointed on.
The query I've tried looks like this:
SELECT appointments. LodgeID, lodges. Lodge, applications. NominationID, applications. Lodges INNER JOIN applications category IT lodges. LodgeID = nominated. NominationID WHERE category = "Best property of Safari in southern Africa" ORDER BY Lodge
But this product:
http://www.safariawards.com/nominees12/southernafrica.php
Its the right number of results, but not the list on the right of the boxes - for example British Airwways is not LodgeID 786
If anyone could help with the SQL right for what would be well appreciated.
That you join on the wrong column. Try this:
SELECT appointments. LodgeID, lodges. Lodge, applications. NominationID, applications. Lodges INNER JOIN applications category IT lodges. LodgeID = nominated. LodgeID WHERE category = "Best property of Safari in southern Africa" ORDER BY Lodge
-
error of dynamics of the associative array (pl/sql), please help
Function down I can hard-coded but not able to go to dynamically can u please friends
CREATE OR REPLACE FUNCTION FN_SUBSCRIPTION_BEHAVIOUR(P_YYMM IN VARCHAR2) RETURN VARCHAR2
AS
ARR_LIST APEX_APPLICATION_GLOBAL. VC_ARR2;
Typ_array. ARRAY TYPE IS VARCHAR2 (16);
array_final typ_array;
V_ARRAY VARCHAR2 (2000);
v_out VARCHAR2 (2000);
v_result VARCHAR2 (2000);
BEGIN
ARR_LIST: = APEX_UTIL. STRING_TO_TABLE (P_YYMM, ',');
Select LISTAGG (fid_value, ',') IN GROUP (ORDER BY fid_value) BY v_array
of filter_detail, filter_master
where fil_id = fid_fil_id
and fil_position = 15
AND NVL (fid_ACTIVE, 'Y') = 'Y ';
array_final: = typ_array (v_array); Commented (1102,1101,1012,1011,1010,1009,1008,1007,1006,1005,1004,1003,1002,1001);
I'm looping 1.array_final.count
If array_final (i) in (arr_list (I)) then v_result: = '1';--Commented--(1002,1003,1007)
Another v_result: = '0';
end if;
v_out: = v_out | v_result;
end loop;
Return v_out;
END;
my output is
00000001000110
Published by: V on March 23, 2011 21:42
Published by: V on March 23, 2011 22:24
Published by: V on March 23, 2011 23:00
Published by: V on March 24, 2011 12:57 AMHello
Please check below, hope this helps.
SQL> SQL> DROP TABLE tmp 2 / Table dropped SQL> CREATE TABLE tmp ( col1 NUMBER) 2 / Table created SQL> INSERT INTO tmp 2 SELECT 1001 FROM DUAL UNION 3 SELECT 1002 FROM DUAL UNION 4 SELECT 1003 FROM DUAL UNION 5 SELECT 1004 FROM DUAL UNION 6 SELECT 1005 FROM DUAL UNION 7 SELECT 1006 FROM DUAL UNION 8 SELECT 1007 FROM DUAL UNION 9 SELECT 1008 FROM DUAL UNION 10 SELECT 1009 FROM DUAL UNION 11 SELECT 1010 FROM DUAL UNION 12 SELECT 1011 FROM DUAL UNION 13 SELECT 1012 FROM DUAL UNION 14 SELECT 1101 FROM DUAL UNION 15 SELECT 1102 FROM DUAL 16 / 14 rows inserted SQL> COMMIT 2 / Commit complete SQL> CREATE OR REPLACE FUNCTION FN_SUBSCRIPTION_BEHAVIOUR(P_YYMM IN VARCHAR2) 2 RETURN VARCHAR2 AS 3 ARR_LIST APEX_APPLICATION_GLOBAL.VC_ARR2; 4 TYPE typ_array IS TABLE OF VARCHAR2(16); 5 array_final typ_array; 6 V_ARRAY VARCHAR2(2000); 7 v_out VARCHAR2(2000); 8 v_result VARCHAR2(2000); 9 BEGIN 10 select LISTAGG(col1, ',') WITHIN 11 GROUP( 12 ORDER BY col1) 13 INTO v_array 14 from tmp; 15 ARR_LIST := APEX_UTIL.STRING_TO_TABLE(v_array, ','); 16 for i in 1 .. ARR_LIST.count loop 17 if (INSTR(P_YYMM, ARR_LIST(i)) > 0) then 18 v_result := '1'; 19 else 20 v_result := '0'; 21 end if; 22 v_out := v_out || v_result; 23 end loop; 24 return v_out; 25 END; 26 / Function created SQL> DECLARE 2 l_out VARCHAR2(2000); 3 BEGIN 4 l_out := FN_SUBSCRIPTION_BEHAVIOUR('1002,1003,1004'); 5 dbms_output.put_line(l_out); 6 END; 7 / 01110000000000 PL/SQL procedure successfully completed SQL>
Ameya
-
Hello world
I need to display the SPER_STATUS_TEXT count as 0 if there is no data from query below. Could someone help me please
SQL > SELECT a.sper_status_text, COUNT (*)
2 from (SELECT sper.assettxt,
CASE 3
4. WHEN sper.sper_status_text = "assessment" said.
5 THEN
6 'confirmed assessment '.
7. WHEN sper.sper_status_text AS "update - rated %".
8 THEN
9 "update - rated up to."
10. WHEN sper.sper_status_text AS "update - % evaluated.
11. CAN
12 'update - rated down"
13 ELSE
14 "other responses.
15 END
16 sper_status_text
17 zzcus.zzcus_sper_data sper
18 WHERE sper.sper_dates = ' 20100801-20100831'
19 AND sper.customer_id = 'NATFINS. '
20 AND sper.task_inquiry_type = "Vendor Comparison"
21 AND sper.assettxt <>'! MAD
(22) a
23 GROUP BY a.sper_status_text
ORDER 24 (CASE
25. WHEN a.sper_status_text = "Said assessment" THEN 1
26. WHEN a.sper_status_text = "update - evaluated until ' THEN 2
27. WHEN a.sper_status_text = 'Update - rated down' THEN 3
28 4 SOMETHING ELSE
END 29);
Results:
SPER_STATUS_TEXT COUNT (*)
------------------------ ----------
Claims assessment 2
I need to display as below (if there no data I need to display the number as 0)
SPER_STATUS_TEXT COUNT (*)
------------------------ ----------
Claims assessment 2
Updated - evaluated up to 0
Updated - rated low 0
Other answers 0
Please adviceYou can get this. Using the TYPE clause.
SQL> SQL> CREATE TABLE ZZCUS_SPER_DATA1 2 ( 3 SPER_STATUS_TEXT VARCHAR2 (30) 4 ,TASK_INQUIRY_TYPE VARCHAR2 (100) 5 ); Table created. SQL> SQL> INSERT INTO ZZCUS_SPER_DATA1 2 VALUES ( 3 'Data Updated', 'Descriptive Data Challenge - Maturity date / Redemption date'); 1 row created. SQL> SQL> INSERT INTO ZZCUS_SPER_DATA1 2 VALUES ('Data Updated', 'Descriptive Data Challenge - Ticker / Local Code'); 1 row created. SQL> SQL> SELECT * 2 FROM ( SELECT A.SPER_STATUS_TEXT, COUNT (*) CNT 3 FROM (SELECT CASE 4 WHEN SPER.SPER_STATUS_TEXT = 'Data Confirmed' 5 THEN 6 'Data Item Confirmed' 7 WHEN SPER.SPER_STATUS_TEXT LIKE 'Data Updated' 8 THEN 9 'Data Item Updated' 10 ELSE 11 'Other Responses' 12 END 13 SPER_STATUS_TEXT 14 FROM ZZCUS_SPER_DATA1 SPER 15 WHERE 1 = 1 16 AND SPER.TASK_INQUIRY_TYPE LIKE 'Descriptive Data Challenge%') A 17 GROUP BY A.SPER_STATUS_TEXT 18 ORDER BY (CASE 19 WHEN A.SPER_STATUS_TEXT = 'Data Item Confirmed' THEN 1 20 WHEN A.SPER_STATUS_TEXT = 'Data Item Updated' THEN 2 21 WHEN A.SPER_STATUS_TEXT = 'Other Responses' THEN 3 22 ELSE 4 23 END)) 24 MODEL 25 DIMENSION BY (SPER_STATUS_TEXT) 26 MEASURES (CNT) 27 RULES 28 (CNT ['Data Item Confirmed'] = NVL (CNT[CV ()], 0), 29 CNT ['Data Item Updated'] = NVL (CNT[CV ()], 0), 30 CNT ['Other Responses'] = NVL (CNT[CV ()], 0)); SPER_STATUS_TEXT CNT ------------------- ---------- Data Item Updated 2 Other Responses 0 Data Item Confirmed 0 3 rows selected. SQL>
G.
-
Hi Experts
I searched Forum, database and made my research on Google... nothing helps... always confused :-/
The X 61 Tablet opportunity is completely clean and I need to install an OS on it, preferably Windows 7.
Can someone give me a clue as to how to install Windows 7 more easily...
I have to go pick up some DVD USB drive?
(remember Newbie ;-): "Lenovo Support - Lenovo ThinkVantage Toolbox for Windows 7 (64-bit) and Vista (64-bit) - portable desktop computers WorkStations_files" help me with drivers... or I have to download them 1 by 1 to the supportpage.)
SRY if the foregoing proves to be too simple for you, dear friends... but I always wanted a Tablet and a thinkpad... hope my dream starts work soon - Thank YOU!
(*_*)
Hello mate,
You can install Windows 7 from a USB key. Take a look here: http://technet.microsoft.com/en-us/magazine/dd535816.aspx
After installing windows install update system: http://www-307.ibm.com/pc/support/site.wss/document.do?lndocid=MIGR-73695
It will automatically download all the drivers you need.
-
Oracle 11G install on Win 7 with PL/SQL Developer Help Needed
Today is my first day with Oracle. I tried to install Ora11g since our network drive. I think that the installation went well. I also have installated PL/SQL Developer when I try to log in I got the following error see below.
---------------------------
PL/SQL Developer - (not connected)
---------------------------
Initialization error
SQL * Net not properly installed
OracleHomeKey: SOFTWARE\ORACLE
OracleHomeDir:
---------------------------
Ok
After I did some research on the Internet I found this solution "go to tools > Preferences > options manually set 'Oracle Home" in the folder "Library OIC" and ORACLE_HOME to file oci.dll is located in ORACLE_HOME/bin/oci.dll.
C:\app\user\product\11.2.0\Client_1\bin.dll < = I think it's my Oracle_Home
C:\app\user\product\11.2.0\client_1\bin\oci.dll < = is my OCI library.
When I apply a thse 2 ways I get the following error.
Initialization error
Could not load C:\app\user\product\11.2.0\client_1\bin.dll «»
OCIDLL to C:\app\user\product\11.2.0\client_1\bin.dll
LoadLibrary (C:\app\user\product\11.2.0\client_1\bin\.dll) returned 0
Can someone help me with this? /PL indicate which version of Win 7 - you need professional or superior - home versions are not taken in charge/certified, then things may or may not work as expected.
http://download.Oracle.com/docs/CD/E11882_01/install.112/e16773/reqs.htm#CHDHGGFE
HTH
Srini -
Hi all
Can anyone help me please with the sql command.
Here is the example of the table:-
Please note that there is % of the letter ' to some account numbers.Table:- EMP *EMP_ID ACCOUNT_NUMBER ACOCUNT_NAME* 102 1658751S10 JOHN MILTON 103 18425335S3 ROSE MILTON 104 184344751S2 CHRISTOPHER MARK 125 20808778S2 SUE 145 224532472S1 ABDUL HALIM AHMAD 165 45216698 RABAB ABDUL 166 5896542 SURAYA AKTER 168 145879 TUHIN AHAMED 169 4578956 FREDERICK ADCOCK 170 4213588 ANDREW HILTON 105 805878997S3 WILLIAM ALLAN 108 98714739S2 KENNETH JOHN ANSTEY 109 1377658043S21 JILLIAN MINEAR BOURNE 111 19942551S12 ELIZABETH MARGARET BLOXHAM
I would like to remove % ' account number and the place, the account name.
After updating the result would be as below:
Please advice how would be to this day.EMP_ID ACCOUNT_NUMBER ACOCUNT_NAME 102 1658751 JOHN MILTON (S10) 103 18425335 ROSE MILTON (S3) 104 184344751 CHRISTOPHER MARK (S2) 125 20808778 SUE (S2) 165 45216698 RABAB ABDUL 166 5896542 SURAYA AKTER
Concerning
JoyI think that u inserted bad records in the table emp1.
Data also well account_number and account_name are interchanged. I think so
check your data
S
-
SQL Loader: Help TRIM and Decode functions please
Hello
I have load data from a flat file, for some columns, I need to use the TRIM and DECODE functions. It's a pipe delimited file.
I get a syntax error (one is lower) same error listed for GARNISH.
SQL * Loader-350: at line xx syntax error.
Expected ', 'or') ', found 'DECODE '.
===========
, FINAL_BILL_DATE CHAR (30) "TRIM(:FINAL_BILL_DATE)".
, BUSINESS_ID 'DECODE(:BUSINESS_ID,'B',1,'C',2,'E',3,'G',4,'O',5,'R',6,'T',7,'U',8,'H',9,-1) '.
Can someone please help.
Thank you
JosianeHello josiane.
The error you receive leads me to believe that at some point before the DECODING on the BUSINESS_ID line, probably some line before the FINAL_BILL_DATE line, it is a syntactic error causing the quotes before DECODING actually put an end to some other syntaxes. Without any lines that might actually contribute to this, including details of the header, it's the best I can advise.Hope this helps,
LukePlease check the answer as helpful or response, if it is so. If this is not the case, further clarification.
Try to always provide create table and table insert to help members of the forum to help you. -
large table PL/SQL error help
Currently, I began by reading Expert Architecture database Oracle 9i and 10g Programming Techniques and Solutions. I can't run the script big_table.sql on my Oracle 11 g R1 database example; I get the following error
ERROR on line 15:
ORA-06550: line 15, column 27:
PL/SQL: ORA-00947: not enough values
ORA-06550: line 15, column 1:
PL/SQL: SQL statement ignored
Kindly help me to understand what I am doing wrong. The code that I am running is less than
9 declare
10 l_cnt number;
Number 11 l_rows: = & 1;
12 start
13 insert / * + append * /.
14 in big_table
15 select rownum, a.*
16 of object a
17 where rownum < = & 1;
18
19 l_cnt: = number of lines sql %;
20
21 commit;
22
while 23 (l_cnt < l_rows)
24 loop
25 insert / * + APPEND * / into big_table
26 select rownum + l_cnt,
OWNER OF 27, OBJECT_NAME, SUBOBJECT_NAME,
28 OBJECT_ID, DATA_OBJECT_ID,
OBJECT_TYPE 29, CREATED, LAST_DDL_TIME,
30 TIMESTAMP, STATUS, TEMPORARY,
GENERATED 31, SECONDARY
32 by big_table
33 where rownum < = l_rows-l_cnt;
34 l_cnt: = l_cnt + sql rowcount %;
35 commit;
36 end loop;
end 37;
38.Hello
In Oracle 11, the other two columns, namespace and edition_name, were added to the object.
Some people (including me) are not familiar with your book, so it would be useful to explain what you're doing. Looks like you need to adjust siomehting in the book because of the additional columns.
-
Hello, I'm doing a migration of SQL Server T - SQL to oracle 11 g PL/SQL, and I don't want to use a global temporary table; Instead, consider using sliders and pl/sql table.
I got hit in a scenario where I need to convert the following in a single sql statement.
Stage of T - SQL:
============
Insert (#ActCde)
InvntrySbLdgrChngeID
DlHdrID
DlDtlID
ChemID
StrtgyID
Quantity
Value
Modified)
Select InvntrySbLdgrChngeID
DlHdrID
DlDtlID
ChildPrdctID
StrtgyID
VolumeChanged
ValueChanged
, 'N'
of InventorySubLedgerChange
where LastInChain = 'Y '.
-updated column "Changed" of particular documents to 'Y' based on conditions
Update #ActCde
Changed the value = 'Y '.
of #ActCde (nolock)
Left Outer Join InventorySubledgerDetail ISD (nolock)
on #ActCde.DlHdrID = DSI. DlDtlChmclDlDtlDlHdrID
and #ActCde.DlDtlID = ISD. DlDtlChmclDlDtlID
and #ActCde.ChemID = DSI. DlDtlChmclChmclChldPrdctID
and #ActCde.StrtgyID = DSI. StrtgyID
and the DSI. AccntngPrdID = @i_AccntngPrdID - variable parameter
Where abs (#ActCde.Qty - isnull (ISD.) BeginningVolume, 0)) >.01
or abs (#ActCde.Value - isnull (ISD.) BeginningValue, 0)) >.01
or (abs(#ActCde.Qty) = 0 and)
ABS(#ActCde.value) = 0 and
ABS (isnull (ISD. BeginningVolume, 0)) = 0 and
ABS (isnull (ISD. BeginningValue, 0)) = 0
)
Convertion of SQL:
===============
I would like to do something like
Select A.InvntrySbLdgrChngeID,
A.DlHdrID,
A.DlDtlID,
A.ChemID,
A.StrtgyID,
A.Qty,
A.Value,
A.Changed
Of
(select InvntrySbLdgrChngeID
DlHdrID
DlDtlID
ChildPrdctID AS ChemID
StrtgyID
VolumeChanged AS Qty,
ValueChanged value have
, 'N'
of InventorySubLedgerChange
where LastInChain = 'Y') A LEFT OUTER JOIN InventorySubledgerDetail B
ON A.DlHdrID = B.DlDtlChmclDlDtlDlHdrID
and A.DlDtlID = B.DlDtlChmclDlDtlID
and A.ChemID = B.DlDtlChmclChmclChldPrdctID
and A.StrtgyID = B.StrtgyID
and B.AccntngPrdID = i_AccntngPrdID - parameter varibale
Where abs (A.Qty - isnull(B.BeginningVolume,0)) >.01
or abs (A.Value - isnull(B.BeginningValue,0)) >.01
or (abs (A.Qty) = 0 and)
ABS (A.value) = 0 and
ABS (IsNull(B.BeginningVolume,0)) = 0 and
ABS (IsNull(B.BeginningValue,0)) = 0
)
And I need to change the 'A.CHANGED' column value 'Y', based on the outer join, as is above T - SQL.
IF this wont work so pls help me to another way to do this.
in this regard, your help is appreciated.
Thank you!
SSTry this
select #ActCde.InvntrySbLdgrChngeID , #ActCde.DlHdrID , #ActCde.DlDtlID , #ActCde.ChildPrdctID , #ActCde.StrtgyID , #ActCde.VolumeChanged , #ActCde.ValueChanged , case when abs(#ActCde.Qty - isnull(ISD.BeginningVolume,0)) > .01 or abs(#ActCde.Value - isnull(ISD.BeginningValue,0)) > .01 or ( abs(#ActCde.Qty) = 0 and abs(#ActCde.Value) = 0 and abs(isnull(ISD.BeginningVolume,0)) = 0 and abs(isnull(ISD.BeginningValue,0)) = 0 ) then 'Y' else 'N' end changed from InventorySubLedgerChange #ActCde Left Outer Join InventorySubledgerDetail ISD (nolock) on #ActCde.DlHdrID = ISD.DlDtlChmclDlDtlDlHdrID and #ActCde.DlDtlID= ISD.DlDtlChmclDlDtlID and #ActCde.ChemID = ISD.DlDtlChmclChmclChldPrdctID and #ActCde.StrtgyID = ISD.StrtgyID and ISD.AccntngPrdID = @i_AccntngPrdID - paramenter variable where LastInChain = "Y"
-
SQL database, helping to start
looking to install my first sql database to an application and I was wondering a few things. I know that many of these applications examples show this process in detail and I will use them but I was wondering besides the creation of the database? The sample applications contain a .db file, which I know is in the database, but it is created within the app? Or separately and I just can he name .db as with the qml or is there a more advanced production process? All documentation or personal experience with this would be welcome and appreciated.
I would seriously recommend Qt classes for Sql management. This works.
Maybe you are looking for
-
Gmail for business does not check user name and password
I read all the information of support here. However, my email is based on my domain name - [email protected]. Despite the use of the stmp.gmail.com and imap.gmail.com by manually configuring account information, TB keeps questioning www.a2hostin
-
Satellite L655 lights not lights only blink
Everything disconnected from the laptop. DVD player, HARD drive, card reader, battery, Wi - Fi. Only the processor and memory (it is tested on another laptop) are connected. I plug in the power supply. The indicator of the power unit connection (the
-
Need to replace the internal hard drive
Hello all, I need to replace the hard drive internal for T61p, product identification 6459cto. What I ask? Thanks Ldxrunner 2015
-
HP Officejet Pro 8600: officejet pro 8600 habit of scanning by plateau
Hello My printer won't scan anything through the plateau on top. I currently have a "HP Officejet Pro 8600' that I use for my mac. When I first put in place more than 6 months ago, I had no problem whatever it is across the Board on top of digitizati
-
updated to windows 8 and problems
I updated my 8 to 8.1 widowns CV last night and now I am unable to view my online banking details and said something about shockwave flash player that I don't know what to do someone can help me.