How to hide repeated details using SQL Query?
How to hide repeated details using SQL Query?
For Ex:
------------------------+
DEPTNO| ENAME | JOB |
------|-------| --------|
10 | JAMES | MANAGER |
10 | BLAKE | CLERK |
10 | FORD | SALESMAN|
20 | SCOTT | MANAGER |
20 | ADAMS | CLERK |
20 | KING | SALESMAN|
------------------------+
How we can display the above details in the following way?
------------------------+
DEPTNO| ENAME | JOB |
------|-------| --------|
10 | JAMES | MANAGER |
| BLAKE | CLERK |
| FORD | SALESMAN|
20 | SCOTT | MANAGER |
| ADAMS | CLERK |
| KING | SALESMAN|
------------------------+
Thanks Advance
Hi,
you can use BREAK ON DEPTNO in SQL*Plus or use LAG.
SQL> ed
Wrote file afiedt.buf
1 select nullif(department_id
2 , lag(department_id) over (partition by department_id order by last_name)
3 ) dept_id
4 , last_name, job_id
5* from employees where department_id in (30,50) and rownum <=10
SQL> /
DEPT_ID LAST_NAME JOB_ID
30 Baida PU_CLERK
Colmenares PU_CLERK
Himuro PU_CLERK
Khoo PU_CLERK
Raphaely PU_MAN
Tobias PU_CLERK
50 Fripp ST_MAN
Kaufling ST_MAN
Vollman ST_MAN
Weiss ST_MAN
10 rows selected.
Similar Messages
-
How to get this output using sql query?
Hi,
How to get this output using sql query?
Sno Name Age ADD Result
1 Anil 23 delhi Pass
2 Shruti 25 bangalor Pass
3 Arun 21 delhi fail
4 Sonu 23 pune Pass
5 Roji 26 hydrabad fail
6 Anil 28 delhi pass
Output
Sno Name Age ADD Result
1 Anil 23 delhi pass
28 delhi passHi Vamshi,
Your query is not pretty clear.
write the select query using Name = 'ANIL' in where condition and display the ouput using Control-break statements.
Regards,
Kannan -
How to insert the records using sql query
hi,
i insert the record uisng sql query and DOTNET programme successfully and increase the doc num .ubut when i try to add record using SAP B1 the old Doc no show.It means its not consider the docnums which are not inserted by sql query.
how can i solve this problem?
Regards,
M.Thippa ReddyYou are not support use Insert / Update / Delete on SAP Databases directly.
SAP will not support any database, which is inconsistent, due to SQL-Queries, which modify datasets or the datastructure of the SAP Business One Database. This includes any update-, delete- or drop-statements executed via SQL-Server Tools or via the the query interface of SAP Business One
Check SAP Note: 896891 Support Scope for SAP Business One - DB Integrity
[https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/smb_searchnotes/display.htm?note_langu=E¬e_numm=896891] -
How to achieve this result using sql query?
hello gurus,
i have a table like this
id name
1 a
2 b
3 c
4 d
5 e
6 f
7 g
8 h
9 i
10 j
11 k
12 l
13 m now my result should be like this
id name id name id name
1 a 6 f 11 k
2 b 7 g 12 l
3 c 8 h 13 m
4 d 9 i
5 e 10 jhow to achieve it by sql query ?
thanks and regards,
friend
Edited by: most wanted!!!! on Feb 22, 2012 5:55 AMhi,
Did you mean this:
with a as
(select 1 id ,'a' name from dual
union all select 2 id ,'b' name from dual
union all select 3 id ,'c' name from dual
union all select 4 id ,'d' name from dual
union all select 5 id ,'e' name from dual
union all select 6 id ,'f' name from dual
union all select 7 id ,'g' name from dual
union all select 8 id ,'h' name from dual
union all select 9 id ,'i' name from dual
union all select 10 id ,'j' name from dual
union all select 11 id ,'k' name from dual
union all select 12 id ,'l' name from dual
union all select 13 id ,'m' name from dual
select
id_1
,name_1
,id_2
,name_2
,id_3
,name_3
from
select
id id_1
,name name_1
,lead(id,5) over (order by id) id_2
,lead(name,5) over (order by id) name_2
,lead(id,10) over (order by id) id_3
,lead(name,10) over (order by id) name_3
,rownum r
from
a
where
r <=5
D_1 NAME_1 ID_2 NAME_2 ID_3 NAME_3
1 a 6 f 11 k
2 b 7 g 12 l
3 c 8 h 13 m
4 d 9 i
5 e 10 j Regards,
Peter -
How to numberformat when using sql:query alogn with c:forEach JSTL tags
Is there anyway to format the numeric values returned from the database when using <sql:query> alogn with <c:forEach> tags
Here is my jsp code
<sql:query..../>
<c:forEach var="row" items="${queryResults.rows}">
<tr>
<td><c:out value="${row.COL1}" /></td>
<td><c:out value="${row.COL2}" /></td>
</tr>
</c:forEach>
Col1 values are numeric without any formats Eg: 1000, 10000, 1000000 etc.
how can i format them to 1,000 , 10,1000 , 100,000 etcIt is polite to mention what your answer was. These posts are not just here for you to ask questions, but to be used as a resource for other people to find answers. Saying "I solved it" with no details helps noone.
I presume you discovered the JSTL <fmt:formatNumber> tag? -
How to get tax break up of TDS using SQL query ?
Hi all,
We are developing a TDS report using SQL query
Report will contain VendorCode,Date(ap inv date),Vendor name,
Bill value,TDS Amount,
Bill Value 100.000,
TDS (2%) - 2.000,
TDS Surcharge(10% on TDS) - 0.2,
TDS Cess(2%(TDS+TDS Surcharge)) - 0.044,
TDS HeCess(1%(TDS+TDS Surcharge)) - 0.022.
We have developed this report which displays upto
VendorCode,Date(ap inv date),Vendor name,
Bill value,TDS Amount.
How to show tax break up of TDS in SQL query ?
Thanks,
With regards,
Jeyakanthan.Hi gauraw,
Thank for your reply.
I modified the query , pasted the query
as below in query generator,
Select T0.DocNum,T0.DocDate,T0.CardCode as 'Ledger',T1.TaxbleAmnt As 'Bill value',T1.WTAmnt as 'TDSAmt',(TDSAmt * 0.1) as 'TDS_Surch',
(((TDSAmt0.1) + TDSAmt)0.02) as 'TDSCess',
(((TDSAmt0.1) + TDSAmt)0.01) as 'TDSHCess'
FROM OPCH T0 INNER JOIN PCH5 T1 ON T0.DocEntry = T1.AbsEntry
WHERE (T0.DocDate >= '[%0]' and T0.DocDate <= '[%1]')
on clicking execute its showing error message invalid column
name 'TDSAmt'.
With regards,
Jeyakanthan -
How to use sql query in java ?
i don't know how to use sql query in java code.
who can give me some advice?
thankshttp://java.sun.com/developer/onlineTraining/Database/JDBC20Intro/
-
hi i am face with problem that is i want to show the how much approximate space required for backup or .bak file to get backup using sql query because i want to show the required memory for backup file on my java application
Hi FIROZ
TENNALI
Is this still an issue, or can we close the thread?
* closing a thread by marking the answer/s (there is a link beneath each response) and you can vote for useful responses as well (there is a link to vote on the left of each response)
Ronen Ariely
[Personal Site] [Blog] [Facebook] -
How to Use SQL Query having IN Clause With DB Adapter
Hi,
I am using 11.1.1.5 want to find out how to Use SQL Query having IN Clause With DB Adapter. I want to pass the IN values dynamically. Any ideas.
Thanksinvoke a stored procedure, it's safer than trying to put together an arbitrary SQL statement in the JCA adapter
-
How to backup database using sql query?
Hello,i'm student, i'm researching oracle database,i want to backup database that using sql query (like backup query in SQL SERVER) ,how to do that ??
Thank!No, database backups cannot be done from within the database.
Commands for backups are outside of the database.
See the "2 Day DBA Guide" http://download.oracle.com/docs/cd/E11882_01/server.112/e10897/toc.htm
and the "Backup and Recovery Users's (actually Adminsitrator's) Guide : http://download.oracle.com/docs/cd/E11882_01/backup.112/e10642/toc.htm
Hemant K Chitale -
How to retrive the blob data from a table using sql query
Hi gurus,
I have a table which has " BLOB "content in a column .I want to view the data From BLOB column using sql query .It would be helpfull If some one share their idea.
Regards,
vardhani.You can use data templates.
See this: http://blogs.oracle.com/xmlpublisher/entry/blob_clob_raw_and_looooong
http://blogs.oracle.com/xmlpublisher/entry/inserting_blobs_into_your_repo
Thanks,
Bipuser -
How to show the VALUE as the Column Header using SQL query?
Hi
I have a requirement to show the picked value as the column header using SQL query.
Example:
======
SELECT EMPNO FROM EMP
WHERE EMPNO=7934;
Result Should be:
7934
7934I have a requirement to show the picked value as the column header using SQL query.In sql*plus you can do
SQL> set verify on
SQL> def e = 7934
old: SELECT empno "&&e" FROM emp WHERE empno = &&e
new: SELECT empno "7934" FROM emp WHERE empno = 7934
SQL> SELECT empno "7934" FROM emp WHERE empno = 7934
7934
7934
1 row selected. -
How to tack print out use with Query ?
Hi
I have to tack purchase order print out (print details- PO date, BP code, name, item name, Quantity and Amount . System Print Layout means from Purchase Order layout designer) use with Query
How to tack print out use with Query (system print layout means from Purchase Order layout designer) ?
Regards
Aravind MHi
I have to take purchase order print out and I created 3 templates for that purchase order in layout designer (Because as per the MIS requirement I created 3 templates, its cover more information). I have to take print out 3 templates at a time. So i try to take print use with Query.
Regards
Aravind M -
Information about constraints by using SQL query?
Hi
how can we view all the definition of a constraint by using SQL query.
Suppose I create following tables:
CREATE TABLE supplier
( supplier_id numeric(10) not null,
supplier_name varchar2(50) not null,
contact_name varchar2(50),
CONSTRAINT supplier_pk PRIMARY KEY (supplier_id, supplier_name)
CREATE TABLE products
( product_id numeric(10) not null,
supplier_id numeric(10) not null,
supplier_name varchar2(50) not null,
CONSTRAINT fk_supplier_comp
FOREIGN KEY (supplier_id, supplier_name)
REFERENCES supplier(supplier_id, supplier_name)
ON DELETE CASCADE
e.g. CONSTRAINT fk_supplier_comp: Plz write me the SQL query that tells that this is a FOREIGN KEY (supplier_id, supplier_name) and REFERENCES supplier(supplier_id, supplier_name) .....etc.
thanksYou mean "What is an Oracle Metalink?"
Then, Oracle Metalink (www.metalink.oracle.com) is an official web site of Oracle Corporation. This is the area where you can get an ultimate and immediate fixes for any sort of Oracle/Issues/Problems. And also, Patches/fixes/Notes/Procedures can be used as reference and can be downloaded from this.
Note: Sharing of Oracle Metalink information/credentials is highly illegal act.
Fore more information and benefits on Oracle Metalink, please take a look at the below URL.
http://www.oracle.com/support/premier/metalink.html
Regards,
Sabdar Syed. -
Checking correct data format using sql query
1) I got column date of joining which accepts date in below format
DD-MON-YYYY
DD-MON-YY
MON-DD-YYYY
MON-DD-YY
Month DD,YYYY
Question:- how do i check whether all dates in Date of joining column are in above format or not using sql query?
2) I got one more date column which accepts date in below format
MMDDYYYY
YYYYMMDD
MM/DD/YYYY
MM/DD/YY
YYYY/DD/MM
Question:- how do i check whether all dates in date column are in above format or not using sql query?
sorry if it is a very simple question since I am new to sql and trying to learn ......Thanks for the answers from the group............In short, NO, it's not possible. If you store dates correctly in the database as DATE datatype then you don't have this problem. If you store them as VARCHAR2 you have a problem.
So, you get a date of 20092012
Is that 20th September 2012? or is it 20th December 2009?
What about...
11-Jan-12
Is that 11th January 2012 or 12th January 2011?
Dates should never be stored on the database as strings. That is why Oracle gives you a DATE datatype so you can store them properly.
Also, when dates are passed from an application to the database, the application should be passing them as DATE datatype, and the application interface should be designed to accept dates from the user in a format specific to their country/locality and it would then know what that format is and automatically convert it to a DATE datatype before it gets anywhere near the database or any SQL.
Maybe you are looking for
-
I recently upgraded to to the iOS 5 on my iMac and iPad. Now when i sync my iPad it get stuck on step 8 with a prompt that says "waiting to copy items" it stays on like that for hours. When I eventually do disconnect my iPad it says sync is not compl
-
How do i get Safari to stop redirecting to mobile sites?
Mobile websites are a curse, and IMO was one of the main reasons people didn't use the mobile web before the iPhone. Now with the iPhone you can view the actual web (minus flash, which I would really like to see soon, hint hint), without having to de
-
Final Cut Studio 2 won't except my old serial number, what should I do?
Final Cut Studio 2 installation software reports invalid serial number when I enter my serial number from Final Cut Studio. What am I doing wrong? My Final Cut Studio is an upgrade from an older version of Final Cut. Can I upgrade an upgrade? My comp
-
Do I need DiskWarrior?? Will it fix this problem?
Hello and thank you for reading. I have had issues with my Macbook Pro ever since I swapped out both the ram and hard drive. I thought at first it was a RAM problem but now have been able to boot my mac from the original hard drive, mounted in an e
-
Dear Friends, I have just now started working on ICWebClient technology and now has to work on the following requirement. The Navigation Link "Identify account" by default has two views namely "Account" and "Registered Product". The requirement is to