Need a sql query to get multiple dates in rows
Hi All,
i need a query to get dates for last 7 days and each dates should be in one row...
but select sysdate from dual..gives one row...
Expexcted Output
Dates:
01-oct-2013
30-sep-2013
29-sep-2013
28-sep-2013
27-sep-2013
26-sep-2013
Hi,
Do you mean that you want all 7 dates together on 1 row?
Here's one way:
SELECT LISTAGG ( TO_CHAR ( SYSDATE + 1 - LEVEL
, 'DD-Mon-YYYY'
) WITHIN GROUP (ORDER BY LEVEL) AS txt
FROM dual
CONNECT BY LEVEL <= 7
This is an example of String Aggregation, that is, taking a column on multiple rows, and concatenating all the values (however many htere happen to be) into 1 big string column 1 row.
Like everything else, exactly how to do it depends on your Oracle version.
For more on String Aggregation, including differetn techniques for different versions, see http://www.oracle-base.com/articles/10g/StringAggregationTechniques.php
Message was edited by: FrankKulash
Sorry, I mis-read the question.
Similar Messages
-
Sql query to get Thursday (Date) for the year 2014
Hello All,
I want to get the date for all the Thursdays in the year 2014. How can I achieve this using SQL query? Can anybody give me a hand with this? Thanks.
AmolHi,
Check if this can help you
DECLARE @counter INT
DECLARE @Date Date
SELECT @counter = 0
Select @Date = '20131226'
WHILE @counter <= 52
BEGIN
select Thursday = convert(varchar(10),DATEADD(WEEK,1, @Date),120)
SELECT @counter = @counter + 1
Select @Date = DATEADD(WEEK,1, @Date)
END
Regards
Prasad Tandel
Please dont forget to mark as answer if this helps you :) -
Sql query to get union of matching rows
I want to write a sql query that shows union f all the [Type] for each [Key] if [Key] has atleast one [Type] in common and for non matched [Key]s it will return the row as it is.
For example In the sql table below [Key] '1' and '2' has [Type] 'B' in common and [Key] '1' and '4' has [Type] 'A' in common. In this case [Key] '1', '2' and '4' are related so result will be union of [Type]s in [Key]s '1', '2' and '4' which are 'A', 'B', 'C'
and 'E' for each [Key]. And [Key] '3' has no [Type] in common so it will return itself.
Input:
declare @categories table ([Key] int, [Type] Char(1))
insert into @categories ([Key], [Type]) values (1, 'A')
insert into @categories ([Key], [Type]) values (1, 'B')
insert into @categories ([Key], [Type]) values (2, 'B')
insert into @categories ([Key], [Type]) values (2, 'C')
insert into @categories ([Key], [Type]) values (3, 'D')
insert into @categories ([Key], [Type]) values (4, 'E')
insert into @categories ([Key], [Type]) values (4, 'A')
insert into @categories ([Key], [Type]) values (5, 'F')
insert into @categories ([Key], [Type]) values (5, 'G')
insert into @categories ([Key], [Type]) values (6, 'G')
insert into @categories ([Key], [Type]) values (6, 'H')
Desired output:
Key Type
1 A
1 B
1 C
1 E
2 A
2 B
2 C
3 D
4 A
4 B
4 E
5 F
5 G
5 H
6 F
6 G
6 H
The data element names are wrong. KEY is a reserved word; “Categories" and "type" are called attribute properties in ISO-11179 rules. Matthias Kläy is right; this is a graph problem in disguise, but you can do it with set theory to get what are called
equivalence classes.
An edge in a graph has two nodes. Some authors allow a single node to count as a edge, but a better way is to put the same node on both ends of the edge. Here is the graph in a table with all the needed constraints. This is why you should post DDL and not be
so rude.
DROP TABLE Graph;
CREATE TABLE Graph
(edge INTEGER NOT NULL,
node_1 CHAR(1) NOT NULL,
node_2 CHAR(1) NOT NULL,
CHECK (node_1 <= node_2),
PRIMARY KEY (node_1, node_2));
Here is your data in the correct format.
INSERT INTO Graph
VALUES
(1, 'A', 'B'),
(2, 'B', 'C'),
(3, 'D', 'D'), -- orphan node
(4, 'A', 'E'),
(5, 'F', 'G'),
(6, 'G', 'H');
Now Google Warshall's Algorithm. It uses three nested loops and an adjacency array. This is very clean and fast in a procedural language. Not so much in SQL. Let us do this in steps:
WITH X1 (edge, node1_1, node1_2, node2_1, node2_2 )
AS
(SELECT CASE WHEN G1.edge <> G2.edge
THEN G1.edge ELSE G2.edge END,
G1.node_1, G1.node_2,
G2.node_1, G2.node_2
FROM Graph AS G1, Graph AS G2
WHERE G1.node_1 IN (G2.node_1, G2.node_2)
AND G1.edge <> G2.edge),
X2 (edge, node_1, node_2)
AS
(SELECT edge,
CASE WHEN node1_1 IN (node2_1, node2_2) THEN node1_2 ELSE node1_1 END,
CASE WHEN node2_1 IN (node1_1, node1_2) THEN node2_2 ELSE node2_1 END
FROM X1)
SELECT DISTINCT edge,
CASE WHEN node_1 < node_2 THEN node_1 ELSE node_2 END,
CASE WHEN node_2 < node_1 THEN node_1 ELSE node_2 END
FROM X2;
The X1 subquery gets the paths of length two. The X2 subquery removes the middle node and creates a new sorted edge. Insert these new rows into Graphs, if they are not there. Repeat the process until no more rows are added.
DROP TABLE Graph;
CREATE TABLE Graph
(edge INTEGER NOT NULL,
node_1 CHAR(1) NOT NULL,
node_2 CHAR(1) NOT NULL,
CHECK (node_1 <= node_2),
PRIMARY KEY (node_1, node_2));
INSERT INTO Graph
VALUES
(1, 'A', 'B'),
(2, 'B', 'C'),
(3, 'D', 'D'), -- orphan node
(4, 'A', 'E'),
(5, 'F', 'G'),
(6, 'G', 'H');
Here is the monster rolled up into a single statement.
INSERT INTO Graph
SELECT DISTINCT edge,
CASE WHEN node_1 < node_2 THEN node_1 ELSE node_2 END,
CASE WHEN node_2 < node_1 THEN node_1 ELSE node_2 END
FROM (SELECT edge,
CASE WHEN node1_1 IN (node2_1, node2_2) THEN node1_2 ELSE node1_1 END,
CASE WHEN node2_1 IN (node1_1, node1_2) THEN node2_2 ELSE node2_1 END
FROM
(SELECT CASE WHEN G1.edge < G2.edge
THEN G1.edge ELSE G2.edge END,
G1.node_1, G1.node_2,
G2.node_1, G2.node_2
FROM Graph AS G1, Graph AS G2
WHERE G1.node_1 IN (G2.node_1, G2.node_2)
AND G1.edge <> G2.edge) AS X1(edge,node1_1, node1_2, node2_1, node2_2) )
AS X2(edge, node_1, node_2)
EXCEPT
SELECT * FROM Graph;
SELECT * FROM Graph ORDER BY edge, node_1, node_2;
1 A B
1 A C
1 B E
1 C E
2 B C
3 D D
4 A E
5 F G
5 F H
6 G H
--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 -
SQL Query from getting multiple itemName against one production No.
Hello Everyone !!!!!!
My Client required an interface which can combine the production cycle. In which single Interface shows all the Production cycle like Bills of material, Production Order, Issue from Production and received from Production.
Similarly i have developed single interface for now i have 1 problem ,
when i show all the the production order number in a matrix i got Prodcution order number, DocNo,and Status .
as u know in one production order against multiple items, Similarly in multiple items there have been multiple ItemNames , I need multiple ItemName .
For this i have developed a Query but unfortunately my query doesn't show all the ItemName.
Select Distinct B.* from OWOR
Inner Join WOR1 B ON OWOR.DocEntry = B.DocEntry
Inner Join OITM C On OWOR.ItemCode = C.itemCode
Where OWOR.ItemCode = '16.0LF2060WGD'
And OWOR.Status = 'R'
AND DocNum = 708680
Here 16.0LF2060WGD= Production order Number
R = Status of that production Order number which is in the Release Mode
Please make sure that in one Production order against multiple itemcode nad multiple ItemName exist and Production order also Exist in the OITM table ........Please help me out
Could anybody help me out to update my Query according to my Client request ...
Please ..............
Thanx
Edited by: Rizzikhan on Oct 13, 2010 9:31 AMHello Everyone !!!!!!
My Client required an interface which can combine the production cycle. In which single Interface shows all the Production cycle like Bills of material, Production Order, Issue from Production and received from Production.
Similarly i have developed single interface for now i have 1 problem ,
when i show all the the production order number in a matrix i got Prodcution order number, DocNo,and Status .
as u know in one production order against multiple items, Similarly in multiple items there have been multiple ItemNames , I need multiple ItemName .
For this i have developed a Query but unfortunately my query doesn't show all the ItemName.
Select Distinct B.* from OWOR
Inner Join WOR1 B ON OWOR.DocEntry = B.DocEntry
Inner Join OITM C On OWOR.ItemCode = C.itemCode
Where OWOR.ItemCode = '16.0LF2060WGD'
And OWOR.Status = 'R'
AND DocNum = 708680
Here 16.0LF2060WGD= Production order Number
R = Status of that production Order number which is in the Release Mode
Please make sure that in one Production order against multiple itemcode nad multiple ItemName exist and Production order also Exist in the OITM table ........Please help me out
Could anybody help me out to update my Query according to my Client request ...
Please ..............
Thanx
Edited by: Rizzikhan on Oct 13, 2010 9:31 AM -
I have a database table where it keeps record of the transaction when it starts at StartTime and when it ends at EndTime. Both these entries are having the timestamp entries. Say for example, I have a tuple with Entries like 'Transaction A' starts at '2014-05-07
20:55:03.170' and ends at '2014-05-08 08:56:03.170'. I need to find the difference between these two timestamps and my expected output is 12:01:00.000. Let me know how to achieve this ?Hi,
You can use below script which calculates difference as DD:HH:MM:SS. You can modify the same:
DECLARE @startTime DATETIME
DECLARE @endTime DATETIME
SET @startTime = '2013-11-05 12:20:35'
SET @endTime = '2013-11-10 01:22:30'
SELECT [DD:HH:MM:SS] =
CAST((DATEDIFF(HOUR, @startTime, @endTime) / 24) AS VARCHAR)
+ ':' +
CAST((DATEDIFF(HOUR, @startTime, @endTime) % 24) AS VARCHAR)
+ ':' +
CASE WHEN DATEPART(SECOND, @endTime) >= DATEPART(SECOND, @startTime)
THEN CAST((DATEDIFF(MINUTE, @startTime, @endTime) % 60) AS VARCHAR)
ELSE
CAST((DATEDIFF(MINUTE, DATEADD(MINUTE, -1, @endTime), @endTime) % 60)
AS VARCHAR)
END
+ ':' + CAST((DATEDIFF(SECOND, @startTime, @endTime) % 60) AS VARCHAR),
[StringFormat] =
CAST((DATEDIFF(HOUR , @startTime, @endTime) / 24) AS VARCHAR) +
' Days ' +
CAST((DATEDIFF(HOUR , @startTime, @endTime) % 24) AS VARCHAR) +
' Hours ' +
CASE WHEN DATEPART(SECOND, @endTime) >= DATEPART(SECOND, @startTime)
THEN CAST((DATEDIFF(MINUTE, @startTime, @endTime) % 60) AS VARCHAR)
ELSE
CAST((DATEDIFF(MINUTE, DATEADD(MINUTE, -1, @endTime), @endTime) % 60)
AS VARCHAR)
END +
' Minutes ' +
CAST((DATEDIFF(SECOND, @startTime, @endTime) % 60) AS VARCHAR) +
' Seconds '
Reference:
http://sqlandme.com/2013/12/23/sql-server-calculating-elapsed-time-from-datetime/
- Vishal
SqlAndMe.com -
SQL query to get transaction detail from DEFERRED_TRAN_ID
Hi,
I'm using Oracle Advance Replication and get the transaction detail from Enterprise Manager Console.
So instead of using the console.
Is there a way any SQL query which get transaction details like SQL query fired, old and new column value etc from DEFERRED_TRAN_ID.
thanksquote:
Originally posted by:
lucapac
I have two tables: tblWorkers and tblSkills. tblWorkers has a
column, Skills, which is populated from a multiple-checkbox form
field with one or more skill_IDs from tblSkills, so each
tblWorkers.Skills consists of a list of one or more comma-delimited
values. For any Skill_ID, I need to generate a listing of all
Workers with the corresponding skill, so I have tried to do
something along the lines of SELECT WorkerName FROM tblWorkers
WHERE Skills IN (Skills, #FORM.Skill_ID#) ... or WHERE Skills IN
(ListFind(Skills, #FORM.Skill_ID#)) ... etc. ??? My results (once I
got data type mismatches out of the way) return all Workers, not
just those with the desired Skill. There must be an easy way to do
this ... How do people with a bit more CF/SQL experience than I
have do this???
As Kronin implied, we normalize our databases. If you don't
understand that answer, the book "Database Design for Mere Mortals"
is often mentioned on this forum. -
Query to get the data of all the columns in a table except any one column
Can anyone please tell how to write a query to get the data of all the columns in a table except one particular column..
For Example:
Let us consider the EMP table.,
From this table except the column comm all the remaining columns of the table should be listed
For this we can write a query like this..
Select empno, ename, job, mgr, sal, hiredate, deptno from emp;
Just to avoid only one column, I mentioned all the remaining ( 7 ) columns of the table in the query..
As the EMP table consists only 8 columns, it doesn't seem much difficult to mention all the columns in the query,
but if a table have 100 columns in the table, then do we have to mention all the columns in the query..?
Is there any other way of writing the query to get the required result..?
Thanks..Your best best it to just list all the columns. Any other method will just cause more headaches and complicated code.
If you really need to list all the columns for a table because you don't want to type them, just use something like...
SQL> ed
Wrote file afiedt.buf
1 select trim(',' from sys_connect_by_path(column_name,',')) as columns
2 from (select column_name, row_number() over (order by column_id) as column_id
3 from user_tab_cols
4 where column_name not in ('COMM')
5 and table_name = 'EMP'
6 )
7 where connect_by_isleaf = 1
8 connect by column_id = prior column_id + 1
9* start with column_id = 1
SQL> /
COLUMNS
EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,DEPTNO
SQL> -
Query for Getting previous date in oracle in specifc scenario
I have the below data in a table A which i need to insert into table B along with one compute column.
TABLE A:
Account_No | Balance | As_on_date
1001 |-100 | 1-Jan-2013
1001 |-150 | 2-Jan-2013
1001 | 200 | 3-Jan-2013
1001 |-250 | 4-Jan-2013
1001 |-300 | 5-Jan-2013
1001 |-310 | 6-Jan-2013
Table B:
In table B,there should be no of days to be shown when balance is negative and the date one which it has gone into negative.
So,for 6-Jan-2013,this table should show below data:
Account_No | Balance | As_on_date | Days_passed | Start_date
1001 | -310 | 6-Jan-2013 | 3 | 4-Jan-2013
Here,no of days should be the days when the balance has gone negative in recent time and not from the old entry.
I need to write a sql query to get the no of days passed and the start date from when the balance has gone negative.
I tried to formulate a query using Lag analytical function,but i am not getting how should i check the first instance of negative balance by traversing back using LAG function. Even the first_value function was given a try but not getting how to partition in it based on negative value.
Any help or direction on this will be really helpful.
ThanksI think you can apply the Tabibitoshan method here. The query is more complex but performs better than other methods. For an explanation, see Tabibitosan method tutorial by Aketi Jyuuzou
The idea behind the method is to identify "continuous" records without gaps. Here I identify records that are "continuous" because they contain an uninterrupted series of negative balances.
drop table t;
CREATE TABLE t (Account_No , Balance , As_on_date) AS SELECT
1001 ,-100 , to_date('1-Jan-13', 'DD-MON-YY') FROM dual UNION ALL SELECT
1001 ,-150 , to_date('2-Jan-13', 'DD-MON-YY') FROM dual UNION ALL SELECT
1001 , 200 , to_date('3-Jan-13', 'DD-MON-YY') FROM dual UNION ALL SELECT
1001 ,-250 , to_date('4-Jan-13', 'DD-MON-YY') FROM dual UNION ALL SELECT
1001 ,-300 , to_date('5-Jan-13', 'DD-MON-YY') FROM dual UNION ALL SELECT
1001 ,-310 , to_date('6-Jan-13', 'DD-MON-YY') FROM dual;
SELECT Account_No, Balance, to_char(As_on_date, 'DD-MON-YYYY') as_on_date,
CASE
WHEN balance < 0
THEN row_number() OVER(PARTITION BY account_no, grp ORDER BY as_on_date)
END days_passed,
CASE
WHEN balance < 0
THEN to_char(
first_value(as_on_date) OVER(PARTITION BY account_no, grp ORDER BY as_on_date),
'DD-MON-YYYY'
end start_date
from (
SELECT Account_No, Balance, As_on_date,
CASE WHEN balance >= 0 THEN NULL ELSE
row_number() OVER(PARTITION BY account_no ORDER BY as_on_date) -
sum(CASE WHEN balance < 0 THEN 1 ELSE 0 END) OVER(PARTITION BY account_no ORDER BY as_on_date)
end grp
FROM t
order by account_no, As_on_date;
ACCOUNT_NO
BALANCE
AS_ON_DATE
DAYS_PASSED
START_DATE
1001
-100
01-JAN-2013
1
01-JAN-2013
1001
-150
02-JAN-2013
2
01-JAN-2013
1001
200
03-JAN-2013
1001
-250
04-JAN-2013
1
04-JAN-2013
1001
-300
05-JAN-2013
2
04-JAN-2013
1001
-310
06-JAN-2013
3
04-JAN-2013 -
SQL query to get a list of relations between workitems
How can I create a SQL query to get a list of all problems with related changes? And all problems with related incidents?
I have tried to join the tables RelationshipTypeDim with ProblemDimKey and ChangeRequestDim, but the results are not correct.The relationships in the data warehouse can be kind of tricky. The relationships are contained in the WorkItemRelatesToWorkItemFactvw table. This table lists the related items by their WorkItemDimKey, so you cannot reference directly from the ChangeRequestDimvw
or ProblemDimvw. You will need to reference the WorkItemDimvw to get the WorkItemDimKey for each entry.
The query below will get all of the related work items from the Change Request class. The way the joins work is ChangeRequestDimvw gets the list of change requests. Then inner joins WorkItemDimvw to get the WorkItemDimKey for each CR. Then inner joins WorkItemRelatesToWorkItemFactvw
to get all of the CRs with related work items. Then inner joins the WorkItemDimvw again to get the ID of the related work item.
Now the tricky part is it appears that these relationship are set based on which item that created the relationship. So you need to union a second query that reverse the relationship on the WorkItemRelatesToWorkItemFactvw.
This query should give you a good start on getting the related work items. You can filter it down from here if you only want to include problems.
SELECT C.ID, WIWI.ID
FROM dbo.ChangeRequestDimvw C
INNER JOIN dbo.WorkItemDimvw WI ON
WI.EntityDimKey = C.EntityDimKey
INNER JOIN dbo.WorkItemRelatesToWorkItemFactvw AS WIRWI ON
WIRWI.WorkItemDimKey = WI.WorkItemDimKey
INNER JOIN dbo.WorkItemDimvw AS WIWI ON
WIWI.WorkItemDimKey = WIRWI.WorkItemRelatesToWorkItem_WorkItemDimKey
union
SELECT C.ID, WIWI.ID
FROM dbo.ChangeRequestDimvw C
INNER JOIN dbo.WorkItemDimvw WI ON
WI.EntityDimKey = C.EntityDimKey
INNER JOIN dbo.WorkItemRelatesToWorkItemFactvw AS WIRWI ON
WIRWI.WorkItemRelatesToWorkItem_WorkItemDimKey = WI.WorkItemDimKey
INNER JOIN dbo.WorkItemDimvw AS WIWI ON
WIWI.WorkItemDimKey = WIRWI.WorkItemDimKey
Order by C.ID
Matthew Dowst |
Blog | Twitter -
Sql query to get distinct count
Hi
I use SQL Server Management Studio
can I have a sql query to get count as shown below against each month column and name column to get distinct count.
for example if there is two rows with the same date period and same name then the count should be one in first row and zero in the next row of the same data.
Table Name: Table1
Column: Month, Name
Month
Name
Count
12/1/2012 0:00
AK
1
12/1/2012 0:00
AK
0
12/1/2012 0:00
AB
1
1/1/2013 0:00
AK
1
1/1/2013 0:00
AK
0
1/1/2013 0:00
AB
1
3/1/2013 0:00
AA
1
3/1/2013 0:00
AK
1
3/1/2013 0:00
AK
0
6/1/2013 0:00
AA
1
6/1/2013 0:00
AK
1
6/1/2013 0:00
AK
0
9/1/2013 0:00
AA
1
9/1/2013 0:00
AK
1
9/13/2013 0:00
AK
1
10/1/2013 0:00
AA
1
10/1/2013 0:00
AK
1
10/1/2013 0:00
AK
0Hi,
Thanks for the query but this query gives the total count like shown below
if see the second row in the below table AK for 2012-12-1 gives total count as 2 but need the query to show the first row as 1 and there after 0
query result
Month name cnt
2012-12-01 00:00:00.000 AB 1
2012-12-01 00:00:00.000 AK 2
2012-12-01 00:00:00.000 AK 2
2013-01-01 00:00:00.000 AB 1
2013-01-01 00:00:00.000 AK 2
2013-01-01 00:00:00.000 AK 2
2013-03-01 00:00:00.000 AA 1
2013-03-01 00:00:00.000 AK 2
2013-03-01 00:00:00.000 AK 2
2013-06-01 00:00:00.000 AA 1
2013-06-01 00:00:00.000 AK 2
2013-06-01 00:00:00.000 AK 2
2013-09-01 00:00:00.000 AA 1
2013-09-01 00:00:00.000 AK 1
2013-09-13 00:00:00.000 AK 1
2013-10-01 00:00:00.000 AA 1
2013-10-01 00:00:00.000 AK 2
2013-10-01 00:00:00.000 AK 2 -
SQL query to get last 6 months records neglect the current month
Hi All;
I need help with
sql query to get last 6 months records neglect the current month
Any help much appreciated
Thanks
Pradnya07SELECT <> FROM tbl WHERE dt >=dateadd(month,-6,GETDATE())
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 -
SQL query to get the Datetime 06 hours prior to the table Datetime value
Hi Experts,
I'm just trying to create a SQL query to get the Datetime which should be 06 hours prior to my Table column value(Executiontime),
Eg: my Executiontime(column) value is 07:00AM means, this query should fetch the detail of first VMName from table at 01:00AM,
SQL Table Name: TestTable
Columns: VMName(varchar),status(varchar) Executiontime(Datetime)
SQL Query : Select Top 1 VMName from
TestTable where convert(date,Exeutiontime)=convert(date,getdate()) and
status='0' and ExecutionTime > dateadd(hour,6,getdate())
Request someone to alter this Query to my requirement or give me the new one.
Regards,
Sundar
SundarHi All,
Thanks for your Prompt response. I tried the below queries, but still I don't have any luck. Actually the queries are returning the value before the condition met (say when the time difference is more than 06 hours). I want the
query to return exactly @ 06 hour difference or less than 06 hours,
Query 01: Select Top 1 VMName from TestTable where
convert(date,Exeutiontime)=convert(date,getdate())
and status='0'
and ExecutionTime >
dateadd(hour,-6,getdate())
Query 02: Select
Top 1 VMName from TestTable where
status='0'
and ExecutionTime >
dateadd(hour,-6,getdate())
Query 03: Select
Top 1 VMName from TestTable where status='0'
and ExecutionTime >
dateadd(hour,-6,ExecutionTime)
Can someone point out the mistake please.
Regards,
Sundar
Sundar -
SQL query to get the list of approvals
Hi,
Could someone let me know the SQL query to get the list of all the pending approvals for a user in OIM 11g R2.
ThanksThere are a few ways to do this:
- The easiest would be to use a Relationship Query from the CMC. To do this, go to the Universes section on the CMC, right click on the relevant universe, select tools >> Check Relationships.
- Use Query Builder. You will need more than one query to pull the information you need. You could try something like the below (for Webi)
SELECT SI_NAME, SI_WEBI, SI_DATACONNECTION FROM CI_APPOBJECTS
WHERE SI_KIND = 'universe' and SI_NAME = 'Universe Name'
This will give you a list of Webi Reports by SI_ID.
You'll need another query to list Webi report names:
SELECT SI_NAME FROM CI_INFOOBJECTS WHERE SI_ID IN (SI_ID from query above)
- This is trivial via Auditing / the Activity universe. This of course will only return reports that have already run.
Best.
Srinivas -
SQL query to get last 10 records in the table?
Hi,
Can anyone tell me the SQL query to get last 10 records in the table?
Thanks!!
MCPPlease, define what "last" means. Sets are unordered by definition, so if you want to retrieve rows from a table in a specific order you need to specify what that order is - e.g. by maintaining a value in a column (or a combination of columns) that you can use in the ORDER BY clause of the SELECT statement.
If, for instance, you kept the time when the row was inserted in a special column (InsertedTime), you could use this in your query like this:
select top (10)
<column list>
from <table or view>
where <restriction(s)>
order by InsertedTime desc;
ML
Matija Lah, SQL Server MVP
http://milambda.blogspot.com -
Adhoc Query Requirement with Multiple Data Source
Hi All,
I have a Adhoc Query Requirement with Multiple Data Source. Is there any way to achive it. Other than Resultant set and bring into Model.
Thanks
SSYou can compare stuff in the EL, but I don't think this is what you need.
You can just use Java code in the backing bean class for all the business logic. You can use DAO classes for database access logic. Finally for displaying you can use the JSF tags such as h:outputText.
Maybe you are looking for
-
How to delete old logs in SAP BI, what is the best way to go?
Hi, below are the issues we are facing, when executing infopackage job is not getting triggred into source system. for activation DSO data it is taking huge time. At the time of seqential read to RSREQDONE table. I think this is due to huge logs in t
-
I just got an Ipod Classic recently and downloaded Itunes. Got my music on my Ipod. My husband just got an Ipod Touch. I followed the directions on how to create a 2nd library and was able to load his music onto his Ipod. My problem is now I can not
-
Apple ID incomplete creation?
Hello, So I guess I created this account I'm using to write this post online and so when I try to sign in on the iTuens store, a window pops up saying: "This Apple ID has not yet been used with the iTunes store. Please review your account information
-
BC 4.8 Migration for SAP e-filing
Hello, We are planning to upgrade existing BC 4.7 to BC 4.8 on new hardware. I am bit concerened about SAP e-filing package for GB customer, How will it function when upgraded to BC 4.8. My basic queries are 1. Is any newer release of BC Application
-
Terminal 2.0.1 split screen icon ?
Hi Guys, With Terminal 2.0.1 we now have tabs in the Terminal window. A feature that has been in Linux for years now is available in OSX. Great improvement ! But what seems to have disappeared is the split screen icon. Has that been removed, or am I