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
7934
I 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.
Similar Messages
-
How to Show total value in the header 2nd page but based on 1st page footer
How to show total value in header in report builder but i have the total have related with the total in footer.
Example
===============================================
Page 1
Empno Ename Sal
1 Scott 1000
2 ALlen 2000
3 Susi 1000
Total Sal Page 1: 4000
===============================================
Page 2
Total Sal Page 1: 4000 --> How to get it?????
Empno Ename Sal
4 Budi 1000
5 Roger 200
6 George 2000
Total Sal Page 2: 3200
Please Help..
Thankshmm .. what i would do is
- create a placeholder column
- create a field in the header and one in the footer
- have the footer field reference the summary column
- have the header field reference the placeholder column
- create a fromat trigger on the footer field to
store the value of the footer into the placeholder column
so when the report is executed and the footer field is formatted, the format trigger stores the current value of the summary in the placeholder. then the pagebreak occures and the header field is formatted .. printing the value.
there might actually be an easier way, just reference the two fields to the same summary column and in theory, since there is nothing happening between the time when the footer is formatted and the header is formatted, the values should be the same .. however this is a theory and i have not actually tested this. since reports does all kinds of fancy optimization this might have unexpected results, but it's worth a try.
thanks,
ph. -
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 colmn value in the legend in ssrs Chart?
How to display Legend values in my ssrs Report like below
I want the values like below.
SuccesCount-2000
FailCount-100
No status-150
Can U pls help me for this
ThanX!I will found the soluction for this ,
Go to Chart Area ->Series Properties->Left Side you have noticed Legend->There you need to add expression in the
fx
i.e ="SuccessCount" & " "& Fields!SuccessCount.value
so you finally get the out put like below
o/p :SuccessCount 2000 -
How to show last value of the delivery week
Hi, iam facing problem displaying last qty value wrt delivery week.
the records in the cube are as follows:
pono item relType releaseWeek deliveryWeek Qty
437645 10 X 292006 302006 100
437645 10 X 292006 312006 90
437645 10 X 292006 322006 80
437645 10 X 302006 312006 85
437645 10 X 302006 322006 70
437645 10 X 302006 332006 120
437645 10 X 312006 322006 75
437645 10 X 312006 332006 80
and so on.............
so i need the following out put. The qty's are last values with respect to Delivery week.
poNo Item RelType DelWeek Qty
437645 10 X 302006 100
437645 10 X 312006 85
437645 10 X 322006 75
437645 10 X 332006 80
Thanks in Advance...
kiranHi thanks for your reply,
i was expecting the same and working on it. that means the infocube contains this Key figure too, right!!!
but can't we show this result directly in the report with out this key fig....
regards
kiran -
I am having trouble with passing dynamic string to sql query for executing SSRS reports.
I am using oracle database and I want to pass where clause parameter as "where LAND_NR = 6" to my select query.
For example: I want to execute Select * from employee :p_where.
where p_where parameter holds value "where LAND_NR = 6"
So it will treat as "Select * from employee where LAND_NR = 6" statement which will give me the list of records to display in my reports.
But it's not taking correct sql command throwing an error as "SQLcommand not properly ended."
How can I achieve this?You need to use dynamic sql
But please keep in mind that since you're using Oracle you may be better off posting this in some Oracle forums
This forum is specifically for SQL Server
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
How to Get Default Value of a Data Type in SQL Query.
Hi all,
I am creating a procedure which will take input the table name and Column Name.
In the Output i would like to have the data type and default value of that data type which will be used by a another procedure to blank the selected column in the database.
I tried with SET NULL on the column but as the database is of navision the table have property set to NOT NULL.
Here is what i have done till now.
Create Procedure Get_Column_type
@parm_table_name nvarchar(200),
@parm_column_name nvarchar(20),
@parm_result nvarchar(20)OUTPUT
AS
BEGIN
select @parm_result =
DATA_TYPE from INFORMATION_SCHEMA.COLUMNS IC
where TABLE_NAME = '[' + @parm_table_name +']' and COLUMN_NAME = '[' + @parm_column_name + ']'
END
GO
Now instead on write a case statement for so many data types in SQL, i was thinking is it possible someway that above procedure also returns the default value which i can set in another procedure.
Let me know if its possible or not? Thanks in advance.Do you looking for something like this?
create table t10 ( c int default 1)
SELECT so.name AS table_name,
sc.name AS column_name,
sm.text AS default_value
FROM sys.sysobjects so
JOIN sys.syscolumns sc ON sc.id = so.id
LEFT JOIN sys.syscomments SM ON sm.id = sc.cdefault
WHERE so.xtype = 'U'
AND SO.name = 't10'
ORDER BY so.[name], sc.colid
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
Expecting the output in specific manner by using sql query
Right now i am executing the query that is showing an output like this
FILTER_CATEGORY NAME
alarm orgObjectTypeRaw
alarm eventType
obj_alm OSS_NAME
obj_alm TYPE
obj_imp OOF INDICATOR
obj_imp PORT TYPE
obj_nwk OSS_NAME
obj_nwk TYPE
obj_rep OSS_NAME
obj_rep TYPE
Here the name of the filter_category is alarm which has different names are orgObjectTypeRaw and eventType and so on..
here only one alram contain different names
i am expecting the output like this...
FILTER_CATEGORY NAME
alarm orgObjectTypeRaw
eventType
obj_alm OSS_NAME
TYPE
obj_imp OOF INDICATOR
PORT TYPE
obj_nwk OSS_NAME
TYPE
obj_rep OSS_NAME
TYPE
Could you please help out meHi,
If you are using SQL*PLUS,then before executing query,execute this command:
BREAK ON FILTER_CATEGORYIf not,then you should modify your query inorder to get row number according to FILTER_CATEGORY
and don't display the category when row number is not 1
Here is an example for you
select case when rno=1 then deptno else null end Deptno,
ename
from
select deptno
,ename
,row_number() over (partition by deptno order by sal) rno
from
scott.emp
)Edited by: Sreekanth Munagala on Jan 6, 2009 2:30 AM -
How to display contineous 10 dates from today date using SQL query
Hi All
I need a requirement of displaying 10 dates and numbers contineously, I have written a query for getting 10 numbers like this
select rownum from dual where rownum < 10 connect by rownum = level;
But i am not able to get the dates, Can any one help me ?Hi Satyaki,
No issues on my 9.2.0.8 client.
SQL*Plus: Release 9.2.0.8.0 - Production on Sat May 3 09:49:17 2008
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
SQL> conn test/test@db10g
Connected.
SQL> select rownum, trunc(sysdate) + rownum from dual where rownum <= 10 connect by rownum = level;
ROWNUM TRUNC(SYS
1 04-MAY-08
2 05-MAY-08
3 06-MAY-08
4 07-MAY-08
5 08-MAY-08
6 09-MAY-08
7 10-MAY-08
8 11-MAY-08
9 12-MAY-08
10 13-MAY-08
10 rows selected.
SQL> Regards -
How to load the value in target column?
Hi
Source: Oracle
Target: Oracle
ODI: 11g
I have an interface which loads the data from source table to target. Some of the columns in the target tables are automatically mapped with source table. Some of the column remain un-mapped. Those who remain un-mapped, I want to load the values in that column by executing an query. So can anybody tell me where I should mention that query whose result would become the value of the specific column.
-Thanks,
ShrinivasYou can put the query (or subquery) into the mapping field.
You can also call a function in the mapping field which may be easier in your case. -
From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?
Hi,
Use NVL or COALESCE:
NVL (col_a, col_b)
Returns col_a if col_a is not NULL; otherwise, it returns col_b.
Col_a and col_b must have similar (if not identical) datatypes; for example, if col_a is a DATE, then col_b can be another DATE or it can be a TIMESTAMP, but it can't be a VARCHAR2.
For more about NVL and COALESCE, see the SQL Language manual: http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions119.htm#sthref1310
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
Explain, using specific examples, how you get those results from that data.
Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
See the forum FAQ: https://forums.oracle.com/message/9362002 -
How to get all the values in one column of a JTable
How to get all the values in one column of a JTable as a Collection of String.
I don;t want to write a for loop to say getValueAt(row, 1) eg for 2nd column.I don;t want to write a for loop to say getValueAt(row, 1) eg for 2nd column. You could always write a custom TableModel that stores the data in the format you want it. It would probably be about 50 lines of code. Or you could write a loop in 3 lines of code. I'll let you decide which approach you want to take.
-
How can I get the value of "Warehose" column in a form
How can I get the value of "Warehouse" column in the form below (I mean what table that contain this value):
Production Supervisor >> Batches >> (Button) Material Details >> (Button) Line Allocations
Well, for more clearly! My problem is I must have the Unit Cost of Items, so I've got it in the cm_cmpt_dtl (table), but if I want to, I must create a relation that require 2 filed, they're Item_ID and Whse_Code.
There's no problem with Item_ID, but Whse_Code seem to be the Mission Impossible (hix, I hate that film!!!!)
I wonder if It was right to post this topic here. But anyway I just post my question here, hope I could get some help.wow, many, many, many.... and many thanks!
Just add a tiny modify to check out the Batch_type
doc_id = (select batch_id from gme_batch_header where batch_no='&batch_number' and batch_type = 0)
Because the batch_no can be duplicated as we also create Batch and Filrm Planned Order.
Many thanks for your support!
P/S: Sorry for my terrible English :P -
How to display the value of a column in a chart at the top of each column
How to display the value of each column in a chart at the top of each column?
Like this?
Done using chart Inspector.
For details, see Chapter 7, Creating Charts from Numerical Data in the Numbers '09 User Guide. The guide may be downloaded via the Help menu in Numbers.
Regards,
Barry -
How can can i subtract the value of the column in each row ?
I want to subtract the value of the column in each row if the row is not enough then continue to next row.
For example
ID QTY
A 20
B 40
C 60
I want to update this table by subtract the value of the column (QTY) out 70 so the result i want will be
ID QTY
A 20 - 70 = -50 --> 0 this row will be updated to 0 and 50 will continue to next row
B 40 - 50 = -10 --> 0 this row will be updated to 0 and 10 will continue to next row
C 60 - 10 = 50 --> Stop loop
How can i write the sql query for this operation , ThanksPlease post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. Learn how to follow ISO-11179 data element naming conventions and formatting rules. You have no idea,
do you? Temporal data should use ISO-8601 formats. Code should be in Standard SQL as much as possible and not local dialect.
This is minimal polite behavior on SQL forums. What did you try on your own before posting? I will bet that you did nothing! You expect other people to do your job or homework for you.
>> I want to subtract the value of the column in each row if the row is not enough then continue to next row. <<
This makes no sense. Rows have no ordering; that is a spreadsheet. There is no such thing as a generic “id” in RDBMS. And an identifier is not a sequence which would have an ordering.
CREATE TABLE Foobar
(something_seq INTEGER NOT NULL PRIMARY KEY,
onhand_qty INTEGER NOT NULL);
Learn how to use the SUM()OVER() and LAG() aggregate functions, post what you tried for yourself and then we will help you.
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL
Maybe you are looking for
-
How to push a view to another view to a specific State in Mobile App?
I want to open a second view that contains some states from the first view. Example: myFirstView with a spark list component: So far I got this code for the view of the list to push to the other views: <fx:Script> <![CDATA[ impor
-
F110 Issue: Posting orders: 8 generated, 7 completed
Hi, I am facing issue with F110, Posting orders: 8 generated, 7 completed. The Payment Run Log shows a problem with the Form Type. I have checked SM13 as well and the log shows: Function Module POST_DOCUMENT Status Update was t
-
Error inserting rows in a table
Hi, I have a flat file. I just need something that will read a file, and store its contents into a table. I developped a code with Pro*C. But I have the following error. Could some one be able to tell me what's the raison of this problem? Is it a rec
-
Without Changing the RecordsDisplyed property how to include in 1 page
hi, Actually i have designed a table in which i add rows by clicking a button when the rows are increasing more than 10 it goes of to next page. The basic functionality is intact but the overall functionality i.e after all completions of rows i kept
-
I am wanting to know how to delete my itunes account/Apple ID ?
I am wanting to know how to delete my itunes account/Apple ID ?