[SQL QUERY] Select TCP Port Monitors and their related Watcher Node
Hi everybody,
I'm working on a SSRS report and SQL Query, I have no problem to find all my TCP Port Monitor (SCOM 2012 R2) based on the DisplayName, but I can't figure out how to get their related watcher nodes (in my case only 1 computer is a watcher node).
I can't find which table, which field, contains this information..?
Here is the query i started to write (i select * since i still searching for the right column):
SELECT
FROM StateView s
INNER JOIN BaseManagedEntity me on me.BaseManagedEntityId=s.BaseManagedEntityId
INNER JOIN MonitorView mv on mv.Id=s.MonitorId
INNER JOIN ManagedTypeView mtv on mtv.Id=s.TargetManagedEntityType
--where mv.DisplayName like 'Ping Target Status Check%'
AND me.IsDeleted = '0'
where mv.DisplayName like '%tcpmon%'
and mv.LanguageCode = 'ENU'
--and s.HealthState in (@state)
ORDER BY s.Lastmodified DESC
It would be great if someone can help me !
Thanks,
Julien
Hi,
After creating a TCP port monitor, we can find a table for this monitor under operationsmanager database :
SELECT *
FROM [OperationsManager].[dbo].[MT_TCPPortCheck_******WatcherComputersGroup]
You will find the warcher computer group.
Regards,
Yan Li
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected]
Similar Messages
-
Sql query to find backgorund jobs and their associated reports
Hi Guys
is there any possibility to find job (jobname) their scheduling and the corresponding reports with their variant via sql queries?
Looking up the tables tbt-something only show %NEWSTEP for the INTREPORT value, so this isn´t clearifying at all.
Maybe you could tell me the tables where the reports and their variants are saved.
Cheers
Fabihi check this...
go to the table TIBCO
there you will find
jobname
jobgroup
report name
job status
but there is no varient specification and
%NEWSTEP is the report name -
Can I put a SQL query into a bind variable and then use it to output report
Hi,
Can I put a SQL query into a bind variable and then use it to output report?
I want to create a report and an item "text area" (say P1_TEXT) which can let user to input a SQL query(they are all technical users and knows SQL very well). Then, I use a bind variable (that text area) to store the SQL statement. Then, I add a submit button and I want to use the following to output the report:
select * from (:P1_TEXT);
Do you think it is possible to do that? Any known limitations for APEX in this area?
Thanks a lot,
AngelaYou can, but make sure it's what you really want to do. Make sure you are VERY familiar with SQL Injection. Most people who know what it is, go out of their way to prevent SQL Injection. You're going out of your way to allow it.
You can try using &P1_TEXT. instead of bind variable syntax. Bind variables are one of the best ways to prevent SQL Injection, which is why it's not working for you.
Once again, I strongly urge you to consider the implications of your app, but this suggestion should get it working.
Tyler -
Sql query slowness due to rank and columns with null values:
Sql query slowness due to rank and columns with null values:
I have the following table in database with around 10 millions records:
Declaration:
create table PropertyOwners (
[Key] int not null primary key,
PropertyKey int not null,
BoughtDate DateTime,
OwnerKey int null,
GroupKey int null
go
[Key] is primary key and combination of PropertyKey, BoughtDate, OwnerKey and GroupKey is unique.
With the following index:
CREATE NONCLUSTERED INDEX [IX_PropertyOwners] ON [dbo].[PropertyOwners]
[PropertyKey] ASC,
[BoughtDate] DESC,
[OwnerKey] DESC,
[GroupKey] DESC
go
Description of the case:
For single BoughtDate one property can belong to multiple owners or single group, for single record there can either be OwnerKey or GroupKey but not both so one of them will be null for each record. I am trying to retrieve the data from the table using
following query for the OwnerKey. If there are same property rows for owners and group at the same time than the rows having OwnerKey with be preferred, that is why I am using "OwnerKey desc" in Rank function.
declare @ownerKey int = 40000
select PropertyKey, BoughtDate, OwnerKey, GroupKey
from (
select PropertyKey, BoughtDate, OwnerKey, GroupKey,
RANK() over (partition by PropertyKey order by BoughtDate desc, OwnerKey desc, GroupKey desc) as [Rank]
from PropertyOwners
) as result
where result.[Rank]=1 and result.[OwnerKey]=@ownerKey
It is taking 2-3 seconds to get the records which is too slow, similar time it is taking as I try to get the records using the GroupKey. But when I tried to get the records for the PropertyKey with the same query, it is executing in 10 milliseconds.
May be the slowness is due to as OwnerKey/GroupKey in the table can be null and sql server in unable to index it. I have also tried to use the Indexed view to pre ranked them but I can't use it in my query as Rank function is not supported in indexed
view.
Please note this table is updated once a day and using Sql Server 2008 R2. Any help will be greatly appreciated.create table #result (PropertyKey int not null, BoughtDate datetime, OwnerKey int null, GroupKey int null, [Rank] int not null)Create index idx ON #result(OwnerKey ,rnk)
insert into #result(PropertyKey, BoughtDate, OwnerKey, GroupKey, [Rank])
select PropertyKey, BoughtDate, OwnerKey, GroupKey,
RANK() over (partition by PropertyKey order by BoughtDate desc, OwnerKey desc, GroupKey desc) as [Rank]
from PropertyOwners
go
declare @ownerKey int = 1
select PropertyKey, BoughtDate, OwnerKey, GroupKey
from #result as result
where result.[Rank]=1
and result.[OwnerKey]=@ownerKey
go
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 -
Operations Manager 2012 - TCP Port Monitor
Hi,
Is it possible to have the TCP port monitor only alert if it fails on subsequent polls, instead of the single connection failure which is the default? We have 3 GPRS connections which intermittently
fail, so we only need to be alerted if they don't come back online after a 5-10 minute inverval and 2 failed connection attempts in a row. We have orchestrator so perhaps a runbook needs to be created?
ThanksHi,
Yes. The Runbook could do this trick. I think you need to make the monitors not to generate alerts when health state changes. Then use runbook to monitor the Health State, if some conditions are ture, an alert will be generated.
I am not so familiar with Orchestrator, you may ask at Orchestrator to get answered of how to design the Runbook.
Juke Chou
TechNet Community Support -
Create TCP port monitor to ping windows server or network device
Dears
I'm trying to create TCP port monitor which tests the ping of a remote network device or windows computer from the watcher node, but I don't know which port to use, is there a specific port number?
Thanks
Mohammad, IT NOC TeamI also would like to share the following article with you. It is a sample script that will use netstat –an to check the TCP ports currently in a listening state on the local system
and parse the output to determine that the defined TCP port is in a listening state.
http://operatingquadrant.com/2009/08/13/scom-locallly-monitoring-a-listening-tcp-port/
Niki Han
TechNet Community Support -
Where is the menu to select the waveform monitors and vectorscope?
I feel stupid but I am unable to find the menu to select the waveform monitors and vectorscope in the newest update to PP CC. Any guidance would be most helpful. Happy Halloween!
FWIW - I have set up a Keyboard Shortcut that Displays Waveforms in the Program Monitor.
My wish was for them to be available as a Button Icon but that is not possible. -
FI Reports using ABAP and their Related Tables
Hi can anyone tell me some of the commonly developed reports from FI using ABAP and their related Tables.
Thank YouYou can find the details about the FI module here
http://www.sap-img.com/sap-fi.htm
Regards,
Ravi
Note : Please mark all the helpful answers -
SQL query to get the monitor target on a monitor
Hi!
I have a list of some custom created Monitors. I need a list of which computers that are using the monitors, the "Monitor target". Please help me with this. It need to be a SQL Query because my powershell have stopped working.Yes that is what i have explained you with the screenshot right it is the one in your screen shot also which is mentioned as (This). If this is a default group then you will not get agents for that refer the below link on how to pull agent list of the Target
group
http://msdn.microsoft.com/en-us/library/bb960484.aspx?cs-save-lang=1&cs-lang=vb#code-snippet-1
Or look at this. You can see what groups the agents are associated manually one by one by using the default SCOM Task.
Go to Administration==> Agent managed==> Select the agent ==> Right click it and click View ==> Select state view.
Once you select this you will have another window opened for that particular agent.
Then click on the name of the agent and on the right hand side bottom you will have a default made task to check to what group's or Targets this agent is associated to. Run that task and you will get the output.
Look at the ones highlighted in RED
Below is the screenshot for your reference. Hope this helps
Gautam.75801 -
SQL Query for full paid invoices and payed out credit notes
Hi alltogether,
I have some problems with a sql query.
I want to export all closed (full paid) invoices and credit notes in a table with the paid date.
The problem is that I have several internal reconciliations for one invoice or credit note.
So with my current query I get all these dates in the result but only for invoices, not for credit notes.
I only need the last internal reconciliation date as payment date for all invoices and credit notes where the open amount is 0.
In SAP B1 the finance team has service invoices and credit notes imported out of an ERP system.
These documents are marked with an 'Y" in the coloumn "U_I_Imported" in the table "OINV" or "ORIN".
SELECT
OINV.DocTotal - OINV.PaidToDate as Offen, OINV.NumAtCard, OINV.U_I_Imported, ORCT.DocDate as 'Zahlungsdatum'
SELECT
OINV.DocTotal - OINV.PaidToDate as Offen, OINV.NumAtCard, OINV.U_I_Imported, ORCT.DocDate as 'Zahlungsdatum'
FROM
OJDT inner join
ORCT on OJDT.BaseRef = ORCT.DocNum inner join
RCT2 on ORCT.DocNum = RCT2.DocNum inner join
OINV on RCT2.BaseAbs = OINV.DocEntry
where
OINV.DocTotal - OINV.PaidToDate = 0 and OINV.U_I_Imported = 'Y'
group by
OINV.NumatCard, OINV.DocTotal - OINV.PaidToDate, OINV.U_I_Imported, ORCT.DocDate
order by
ORCT.DocDate
I hope you can help me.
Kind regards,
MaxThe solution for my problem:
select
OINV.DocTotal - OINV.PaidToDate as 'Offen', OINV.CardCode as 'Kundennummer', OINV.NumAtCard as 'DIAMOD Rechnungsnummer', OINV.DocNum as 'Dokumentennummer', max(ORCT.DocDate) as 'Zahlungsdatum', case when ORCT.DocCurr = (select MainCurncy from OADM) then RCT2.DcntSum else RCT2.DcntSumFC end as 'SkontoRechnungswährung',
RCT2.DcntSum as 'SkontoFirmenwährung'
from
JDT1 inner join
OJDT on JDT1.TransId = OJDT.TransId inner join
ORCT on OJDT.BaseRef = ORCT.DocNum inner join
RCT2 on ORCT.DocNum = RCT2.DocNum inner join
OINV on RCT2.BaseAbs = OINV.DocEntry
where
JDT1.TransType in ('24') and
OINV.U_I_Imported = 'Y' and
OINV.DocTotal - OINV.PaidToDate = 0
group by
OINV.NumAtCard, OINV.DocNum, OINV.CardCode, OINV.DocTotal - OINV.PaidToDate, ORCT.DocCurr, RCT2.DcntSum, RCT2.DcntSumFC
union all
select
OINV.DocTotal - OINV.PaidToDate as Offen, OINV.CardCode as 'Kundennummer', OINV.NumAtCard as 'DIAMOD Rechnungsnummer', OINV.DocNum as 'Dokumentennummer', max(OITR.ReconDate) as 'Zahlungsdatum',
0.0 as 'SkontoRechnungswährung',
0.0 as 'SkontoFirmenwährung'
from
OITR inner join
ITR1 on OITR.ReconNum = ITR1.ReconNum inner join
OINV on ITR1.SrcObjAbs = OINV.DocEntry
where
OINV.DocTotal - OINV.PaidToDate = 0 and ITR1.SrcObjTyp = 13 and OINV.U_I_Imported = 'Y'
group by
OINV.NumatCard, OINV.DocNum, OINV.CardCode, OINV.DocTotal - OINV.PaidToDate
union all
select
ORIN.DocTotal - ORIN.PaidToDate as Offen, ORIN.CardCode as 'Kundennummer', ORIN.NumAtCard as 'DIAMOD Rechnungsnummer', ORIN.DocNum as 'Dokumentennummer', max(OITR.ReconDate) as 'Zahlungsdatum',
0.0 as 'SkontoRechnungswährung',
0.0 as 'SkontoFirmenwährung'
from
OITR inner join
ITR1 on OITR.ReconNum = ITR1.ReconNum inner join
ORIN on ITR1.SrcObjAbs = ORIN.DocEntry
where
ORIN.DocTotal - ORIN.PaidToDate = 0 and ITR1.SrcObjTyp = 14 and ORIN.U_I_Imported = 'Y'
group by
ORIN.NumatCard, ORIN.DocNum, ORIN.CardCode, ORIN.DocTotal - ORIN.PaidToDate -
Different Results from SQL-Query in Oracle 10.2 and Oracle 11.2
Look at the following example:
CREATE TABLE GZP_PLAN (GZP_ID
NUMBER(9) NOT NULL, PARENT_GZP_ID NUMBER(9),
CONSTRAINT GZP_PLAN_PK1 PRIMARY KEY(GZP_ID)
USING INDEX
TABLESPACE USERS
TABLESPACE USERS;
insert into GZP_PLAN values(1,NULL);
CREATE TABLE GZP_WB (OBJECTID NUMBER
NOT NULL, GZP_ID NUMBER(10),
CONSTRAINT GZP_WB_PK1_1 PRIMARY KEY(OBJECTID)
USING INDEX
TABLESPACE USERS
TABLESPACE USERS;
insert into GZP_WB values(1,1);
CREATE OR REPLACE VIEW VW_GZP (GZP_ID1) AS
SELECT xxx.gzp_id
FROM gzp_plan xxx
WHERE gzp_id IN (
SELECT MAX (z.gzp_id) zzz
FROM gzp_plan z
START WITH z.gzp_id = xxx.gzp_id
CONNECT BY PRIOR gzp_id = parent_gzp_id);
-- query
select a.* from GZP_WB a where gzp_id in (select gzp_id1 from vw_gzp);
Result in Oracle 10.2. (Windows Server 2003 32-bit, Oracle 10.2.0.2 or Oracle 10.2.0.5, Enterprise Edition)
OBJECTID GZP_ID
*1 1*
Result in Oracle 11.2 (Windows Server 2008 64-bit, Oralcle 11.2.0.2, Enterprise Edition or Standard Edition One)
no rows selected
The result of the following queries are identical in Oracle 10.2 and 11.2
SQL> select * from GZP_WB where to_char(gzp_id) in
2 (select to_char(gzp_id1) from vw_gzp);
OBJECTID GZP_ID
1 1
SQL>
SQL> select a.* from GZP_WB a, vw_gzp b where a.gzp_id=b.gzp_id1;
OBJECTID GZP_ID
1 1The solution is Oracle 11.2.0.3 - patchset released 11th November.
-
SQL query: select billaddress if no delivery address exist.
hi sql expert,
The Query shall filter all invoices by date, articles and show the delivery address. Problem: Not every customer has deposited a delivery address. In this case the billing address is to be taken.
How can this be done ?
This query
SELECT T0.[CardName], T3.[ZipCode],T3.[Street], T1.[ItemCode], T1.[Dscription], T1.[ShipDate], T1.[Price], (T1.[Price] * T1.[Quantity]) as "Gesamtpreis in €", T1.[FreeTxt],substring(T1.Freetxt,0,5) as "Grundpreis in €",substring(T1.Freetxt,9,6) as "TS-Wert in %", T1.[Quantity] FROM OINV T0 INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OCRD T2 ON T0.CardCode = T2.CardCode INNER JOIN CRD1 T3 ON T2.CardCode = T3.CardCode WHERE CONVERT(nvarchar(8), T1.ShipDate, 112) BETWEEN '[%FromDate]' AND '[%ToDate]'
and T1.Itemcode = [%0] GROUP BY T0.[DocNum], T0.[CardName], T3.[ZipCode],T3.[Street], T1.[ItemCode], T1.[Dscription], T1.[ShipDate], T1.[Price], T1.[FreeTxt], T1.[Quantity]
UNION ALL
SELECT T0.[CardName], T3.[ZipCode],T3.[Street], T1.[ItemCode], T1.[Dscription], T1.[ShipDate], -T1.[Price], -(T1.[Price] * T1.[Quantity]) as "Gesamtpreis in €", T1.[FreeTxt], ('-' + substring(T1.Freetxt,0,5)) as "Grundpreis in €",substring(T1.Freetxt,9,6) as "TS-Wert in %", -T1.[Quantity] FROM ORIN T0 INNER JOIN RIN1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OCRD T2 ON T0.CardCode = T2.CardCode INNER JOIN CRD1 T3 ON T2.CardCode = T3.CardCode WHERE CONVERT(nvarchar(8), T1.ShipDate, 112) BETWEEN '[%FromDate]' AND '[%ToDate]' and T1.Itemcode = [%0]
GROUP BY T0.[DocNum], T0.[CardName], T3.[ZipCode],T3.[Street], T1.[ItemCode], T1.[Dscription], T1.[ShipDate], T1.[Price], T1.[FreeTxt], T1.[Quantity]
Thanks a lot!hi,
I think I got it now :-)
First: Show me priority all delivery addresses . Otherwise billing addresses:
SELECT T1.[CardCode], T2.[Street] FROM OCRD T1 INNER JOIN CRD1 T2 ON T1.CardCode = T2.CardCode WHERE NOT EXISTS
SELECT *
FROM CRD1 as T2
WHERE T2.[AdresType] = 's' and t1.CardCode = t2.Cardcode
union
SELECT T1.[CardCode], T2.[Street] FROM OCRD T1 INNER JOIN CRD1 T2 ON T1.CardCode = T2.CardCode
where T2.[AdresType] = 's'
secondly:
Filter all invoices by date, articles and show priority the delivery address else billingaddress and subtract the credits:
SELECT T0.[Cardcode], T0.[CardName], T3.[ZipCode],T3.[Street], T1.[ItemCode], T1.[Dscription], T1.[ShipDate], T1.[Price], (T1.[Price] * T1.[Quantity]) as "Gesamtpreis in €", T1.[FreeTxt],substring(T1.Freetxt,0,5) as "Grundpreis in €",substring(T1.Freetxt,9,6) as "TS-Wert in %", T1.[Quantity]
FROM OINV T0 INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OCRD T2 ON T0.CardCode = T2.CardCode INNER JOIN CRD1 T3 ON T2.CardCode = T3.CardCode
WHERE CONVERT(nvarchar(8), T1.ShipDate, 112) BETWEEN '[%FromDate]' AND '[%ToDate]'
and T1.Itemcode = [%0] and not exists (
SELECT *
FROM CRD1 as T3
WHERE T3.[AdresType] = 's' and t2.CardCode = t3.Cardcode
GROUP BY T0.[Cardcode], T0.[DocNum],T0.[CardCode], T0.[CardName], T3.[ZipCode],T3.[Street], T1.[ItemCode], T1.[Dscription], T1.[ShipDate], T1.[Price], T1.[FreeTxt], T1.[Quantity]
union
SELECT T0.[Cardcode], T0.[CardName], T3.[ZipCode],T3.[Street], T1.[ItemCode], T1.[Dscription], T1.[ShipDate], T1.[Price], (T1.[Price] * T1.[Quantity]) as "Gesamtpreis in €", T1.[FreeTxt],substring(T1.Freetxt,0,5) as "Grundpreis in €",substring(T1.Freetxt,9,6) as "TS-Wert in %", T1.[Quantity]
FROM OINV T0 INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OCRD T2 ON T0.CardCode = T2.CardCode INNER JOIN CRD1 T3 ON T2.CardCode = T3.CardCode
Where T3.[AdresType] = 's' and T1.Itemcode = [%0] and CONVERT(nvarchar(8), T1.ShipDate, 112) BETWEEN '[%FromDate]' AND '[%ToDate]'
-- ab hier werden die Gutschriften abgezogen
union
SELECT T0.[Cardcode], T0.[CardName], T3.[ZipCode],T3.[Street], T1.[ItemCode], T1.[Dscription], T1.[ShipDate], -T1.[Price], -(T1.[Price] * T1.[Quantity]) as "Gesamtpreis in €", T1.[FreeTxt], ('-' + substring(T1.Freetxt,0,5)) as "Grundpreis in €",substring(T1.Freetxt,9,6) as "TS-Wert in %", -T1.[Quantity] FROM ORIN T0 INNER JOIN RIN1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OCRD T2 ON T0.CardCode = T2.CardCode INNER JOIN CRD1 T3 ON T2.CardCode = T3.CardCode WHERE CONVERT(nvarchar(8), T1.ShipDate, 112) BETWEEN '[%FromDate]' AND '[%ToDate]' and T1.Itemcode = [%0]
and not exists (
SELECT *
FROM CRD1 as T3
WHERE T3.[AdresType] = 's' and t2.CardCode = t3.Cardcode
GROUP BY T0.[Cardcode], T0.[DocNum], T0.[CardName], T3.[ZipCode],T3.[Street], T1.[ItemCode], T1.[Dscription], T1.[ShipDate], T1.[Price], T1.[FreeTxt], T1.[Quantity]
union
SELECT T0.[Cardcode], T0.[CardName], T3.[ZipCode],T3.[Street], T1.[ItemCode], T1.[Dscription], T1.[ShipDate], T1.[Price], (T1.[Price] * T1.[Quantity]) as "Gesamtpreis in €", T1.[FreeTxt],substring(T1.Freetxt,0,5) as "Grundpreis in €",substring(T1.Freetxt,9,6) as "TS-Wert in %", T1.[Quantity]
FROM OINV T0 INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OCRD T2 ON T0.CardCode = T2.CardCode INNER JOIN CRD1 T3 ON T2.CardCode = T3.CardCode
Where T3.[AdresType] = 's' and T1.Itemcode = [%0] and CONVERT(nvarchar(8), T1.ShipDate, 112) BETWEEN '[%FromDate]' AND '[%ToDate]' -
SQL Query to search for most and least popular brands bought by spesific client and total
Hi to SQL query masters!
I need to create a report on most and least popular brand names within one specific client orders.
For example, during last month or a year among 100% of specific client's orders were 70% IBM products, 20% of HP and 10% Lenovo products.
How do I do that?
And I also think that it might be useful to have a query that shows top popular brands among all sales in given period of time – this statistic might improve warehouse turnover and marketing activities on least popular brand names.
I tried to use info from this link, but it didn’t help https://websmp106.sap-ag.de/~form/sapnet?_SCENARIO=01100035870000000183&_FRAME=OBJECT&_HIER_KEY=701100035871000439554&
Kind regards,
Ilya.Hi
Please Check this
SELECT COUNT (T2.[CardCode]) as 'no of sales', T3.ItmsGrpNam,T2.Cardname
FROM rdr1 T0 INNER JOIN OITM T1 ON T0.ItemCode = T1.ItemCode INNER JOIN ORDR T2 ON T0.DocEntry = T2.DocEntry
INNER JOIN OITB T3 ON T1.ItmsGrpCod = T3.ItmsGrpCod
WHERE T2.[DocDate] >= [%0] and T2.[DocDate] <= [%1]
GROUP BY T3.ItmsGrpNam,T2.Cardname
ORDER BY COUNT (T2.[cardcode]) desc -
Sql query - Selecting last recorded values for each date in specified period
Hello,
Can someone please help me with my problem.
I'm trying to get last recorded balance for each day for specific box (1 or 2) in specified period of days from ms access database using ADOTool.
I'm trying to get that information with SQL query but so far unsuccessfully...
My table looks like this:
Table name: TestTable
Date Time Location Box Balance
20.10.2014. 06:00:00 1 1 345
20.10.2014. 12:00:00 1 1 7356
20.10.2014. 18:45:00 1 1 5678
20.10.2014. 23:54:00 1 1 9845
20.10.2014. 06:00:02 1 2 35
20.10.2014. 12:00:04 1 2 756
20.10.2014. 18:45:06 1 2 578
20.10.2014. 23:54:10 1 2 845
21.10.2014. 06:00:00 1 1 34
21.10.2014. 12:05:03 1 1 5789
21.10.2014. 15:00:34 1 1 1237
21.10.2014. 06:00:00 1 2 374
21.10.2014. 12:05:03 1 2 54789
21.10.2014. 15:00:34 1 2 13237
22.10.2014. 06:00:00 1 1 8562
22.10.2014. 10:00:00 1 1 1234
22.10.2014. 17:03:45 1 1 3415
22.10.2014. 22:00:00 1 1 6742
22.10.2014. 06:00:05 1 2 562
22.10.2014. 10:00:16 1 2 123
22.10.2014. 17:03:50 1 2 415
22.10.2014. 22:00:10 1 2 642
23.10.2014. 06:00:00 1 1 9876
23.10.2014. 09:13:00 1 1 223
23.10.2014. 13:50:17 1 1 7768
23.10.2014. 19:47:40 1 1 3456
23.10.2014. 21:30:00 1 1 789
23.10.2014. 23:57:12 1 1 25
23.10.2014. 06:00:07 1 2 976
23.10.2014. 09:13:45 1 2 223
23.10.2014. 13:50:40 1 2 78
23.10.2014. 19:47:55 1 2 346
23.10.2014. 21:30:03 1 2 89
23.10.2014. 23:57:18 1 2 25
24.10.2014. 06:00:55 1 1 346
24.10.2014. 12:30:22 1 1 8329
24.10.2014. 23:50:19 1 1 2225
24.10.2014. 06:01:00 1 2 3546
24.10.2014. 12:30:26 1 2 89
24.10.2014. 23:51:10 1 2 25
Let's say the period is 21.10.2014. - 23.10.2014. and I want to get last recorded balance for box 1. for each day. The result should look like this:
Date Time Location Box Balance
21.10.2014. 15:00:34 1 1 1237
22.10.2014. 22:00:00 1 1 6742
23.10.2014. 23:57:12 1 1 25
So far I've managed to write a query that gives me balance for ONLY ONE date (date with highest time in whole table), but I need balance for EVERY date in specific period.
My incorrect code (didn't manage to implement "BETWEEN" for dates...):
SELECT TestTable.[Date], TestTable.[Time], TestTable.[Location], TestTable.[Box], TestTable.[Balance]
FROM TestTable
WHERE Time=(SELECT MAX(Time)
FROM TestTable
WHERE Location=1 AND Box=1 );
Tnx!
Solved!
Go to Solution.For loop
following query keep day (here 24 in below query) Variable from ( 1 to 28-29/30/31 as per month)
SELECT TOP 1 TestTable.[Date], TestTable.[Time], TestTable.[Location], TestTable.[Box], TestTable.[Balance]
FROM Test Table.
WHERE Time=(SELECT MAX(Time) FROM TestTable WHERE Location=1 AND Box=1 )
AND DATE = "2014-10-24";
PBP (CLAD)
Labview 6.1 - 2014
KUDOS ARE WELCOMED.
If your problem get solved then mark as solution. -
R12 Payables: SQL Query to List Invoices along with their Validation Status
Hi All,
I am looking for a SQL query that gives me the list of all AP Invoices and their Validation Status.
Thanks,
Anilselect invoice_id, invoice_num, invoice_amount, invoice_currency_code, approval_status_lookup_code from AP_INVOICES_V ;
--Prasanna
Maybe you are looking for
-
How do I transfer apps from Itunes to my iTouch?
Hi! I'm a new apple user.My father bought me a new iPod touch. I have downloaded some apps from iTunes in my PC (Windows 7), and I want to transfer it to my iPod touch. I thought that syncing would do the trick. But there's a pop up message box sayin
-
Generate Paper Report with dynamic columns in Reports 9i
Hi, I'd like to know if it's possible to select wich columns I want to show in the report just before it is shown. If yes, how can I do it? I'm using 9i Developer Suite and I'm calling the report from Oracle Forms. Thanx
-
Travel Expense Manager (tcode:PR05), how to auto remove record?
Hi, all, In Travel Expense Manager (tcode:PR05), after u select a trip for a certain personal number, u will go into details screen. Then when u select a single receipt from the below tab called 'Receipts' and then click the 'Enhanced Cost Assignment
-
Updated to itunes10,and can't play my songs imported from cd's
I updated to Itunes 10, and now I can't play my music imported from cd;s. It's saying files can't be found,but the songs are still listed on itunes.What can I do to locate my songs????
-
Hi all, I just want to know if AIM-CUE can work with cucme and cucm 8.0? Because based on this matrix Cisco Unity Express Compatibility Matrix [Cisco Unity Express] - Cisco Systems It says that it is supported, but CUE (AIM-CUE Module) should have a