Alternate of Min/Max
I have a query which uses Min function.
I want to use something alternate in order to avoid Min/Max or order by.
I have a query which selects a row based on the min value of one of its column.
how to avoid the use of min..
ex:
a query is like
Select a.name from all_names a
where a.active_date = (select min(active_date) from all_names ))
Manas,
Did you get Hoek's example Query, here is the Tested example run
SQL> select * from emp e
2 where not exists ( select null
3 from emp x where x.hiredate < e.hiredate)
4 /
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 17-DEC-80 800 99
SQL> select * from emp e
2 where e.hiredate
3 = ( select min(hiredate) from emp )
4 /
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 17-DEC-80 800 99Explain Plans
SQL> explain plan for
2 select * from emp e
3 where not exists ( select null
4 from emp x where x.hiredate < e.hiredate);
Explained.
SQL> select * from TABLE(DBMS_XPLAN.DISPLAY)
2 /
PLAN_TABLE_OUTPUT
Plan hash value: 2238887044
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 13 | 585 | 8 (25)| 00:00:01 |
| 1 | MERGE JOIN ANTI | | 13 | 585 | 8 (25)| 00:00:01 |
| 2 | SORT JOIN | | 14 | 518 | 4 (25)| 00:00:01 |
| 3 | TABLE ACCESS FULL| EMP | 14 | 518 | 3 (0)| 00:00:01 |
|* 4 | SORT UNIQUE | | 14 | 112 | 4 (25)| 00:00:01 |
| 5 | TABLE ACCESS FULL| EMP | 14 | 112 | 3 (0)| 00:00:01 |
Predicate Information (identified by operation id):
4 - access(INTERNAL_FUNCTION("X"."HIREDATE")<INTERNAL_FUNCTION("E"."H
IREDATE"))
filter(INTERNAL_FUNCTION("X"."HIREDATE")<INTERNAL_FUNCTION("E"."H
IREDATE"))
20 rows selected.
SQL> explain plan for select * from emp e
2 where e.hiredate
3 = ( select min(hiredate) from emp )
4 /
Explained.
SQL> select * from TABLE(DBMS_XPLAN.DISPLAY)
2 /
PLAN_TABLE_OUTPUT
Plan hash value: 1876299339
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 37 | 6 (0)| 00:00:01 |
|* 1 | TABLE ACCESS FULL | EMP | 1 | 37 | 3 (0)| 00:00:01 |
| 2 | SORT AGGREGATE | | 1 | 8 | | |
| 3 | TABLE ACCESS FULL| EMP | 14 | 112 | 3 (0)| 00:00:01 |
Predicate Information (identified by operation id):
1 - filter("E"."HIREDATE"= (SELECT MIN("HIREDATE") FROM "EMP" "EMP"))
15 rows selected.I hope your query is answered.
SS
Similar Messages
-
Hi All,
What is the difference between both, Min Max & ReOrder Planning?
ThanksHi,
Min-Max planning will be either maintained at Subinventory level or Organization level.
If the onhand Qty falls below either minimum or Maximum level then system will generate either Purchase Requisitions or Work Orders in WIP module to replinish the inventory.
On running the Min-Max report system will consider the existing Onhand,PO qty or the Sales Order demand as per the input parametres.
Reorder Point is an alternate planning method for Min-Max planning method.
This will replinish once the Item Onhand falls below {Safety Stock+(LeadtimeX Demand)}.This will also produce Purhcase Requisitions for replinishments.
Thanks
-Arif. -
Want to set Min Max for a material for PD MRP type
Hi,
I know Maximum stock level field in Material master MRP 2 view ? but where do i maintain minimum stock level? not procured?
My client wants to set up his inventory with Min Max levels using MRP PD?
Thanks and Apprecaites help.
Regards,
SivaHi,
If you want to maintain a Max and Min stock level, Maximum stock is shown straight away, you cannot find the Minimum field directly.
if you want to use MRP type PD then go for safety stock that will be your minimum stock level
or else use Re-order point planning, re-order point will be your minimum and Max-level as maximum.
Thanks
Satya -
How to Get the min,max and original values in a single query
Hi,
I have a task where in i have to the min , max and the original values of a data set .
I have the data like below and i want the target as well as mentioned below
SOURCE
DATASOURCE
INTEGRATIONID
SLOT_DATE
SLOT1
SLOT2
SLOT3
SLOT4
SLOT5
SLOT6
SLOT7
SLOT8
SLOT9
SLOT10
1
101
201111
100
100
200
100
100
100
300
300
300
300
1
101
2011112
200
200
200
200
100
100
100
100
200
300
TARGET
DATASOURCE
INTEGRATIONID
SLOT_DATE
SLOT_VALUE
SLOT MIN
SLOT_MAX
SLOT NUMBER
1
101
201111
100
1
2
SLOT1
1
101
201111
100
1
2
SLOT2
1
101
201111
200
3
3
SLOT3
1
101
201111
100
4
6
SLOT4
1
101
201111
100
4
6
SLOT5
1
101
201111
100
4
6
SLOT6
1
101
201111
300
7
10
SLOT7
1
101
201111
300
7
10
SLOT8
1
101
201111
300
7
10
SLOT9
1
101
201111
300
7
10
SLOT10
1
101
2011112
200
1
4
SLOT1
1
101
2011112
200
1
4
SLOT2
1
101
2011112
200
1
4
SLOT3
1
101
2011112
200
1
4
SLOT4
1
101
2011112
100
5
8
SLOT5
1
101
2011112
100
5
8
SLOT6
1
101
2011112
100
5
8
SLOT7
1
101
2011112
100
5
8
SLOT8
1
101
2011112
200
9
9
SLOT9
1
101
2011112
300
10
10
SLOT10
e
so basically i would first denormalize the data using the pivot column and then use min and max to get the slot_start and slot_end.
But then i
can get the min and max ... but not the orignal values as well.
Any thoughts would be appreciated.
ThanksIf you want to end up with one row per slot per datasource etc, and you want the min and max slots that have the same value as the current slot, then you probably need to be using analytic functions, like:
with t as
(SELECT 1 datasource,101 INTEGRATIONID, 201111 slotdate, 100 SLOT1, 100 SLOT2, 200 slot3, 100 slot4, 100 slot5, 100 slot6, 300 slot7, 300 slot8, 300 slot9, 300 slot10 FROM DUAL union all
SELECT 1, 101, 2011112, 200, 200, 200, 200, 100, 100, 100, 100, 200, 300 FROM DUAL),
UNPIVOTED AS
(SELECT DATASOURCE,INTEGRATIONID,SLOTDATE,1 SLOT,SLOT1 SLOT_VALUE
FROM T
UNION ALL
SELECT DATASOURCE,INTEGRATIONID,SLOTDATE,2 SLOT,SLOT2
FROM T
UNION ALL
SELECT DATASOURCE,INTEGRATIONID,SLOTDATE,3 SLOT,SLOT3
FROM T
UNION ALL
SELECT DATASOURCE,INTEGRATIONID,SLOTDATE,4 SLOT,SLOT4
FROM T
UNION ALL
SELECT DATASOURCE,INTEGRATIONID,SLOTDATE,5 SLOT,SLOT5
FROM T
UNION ALL
SELECT DATASOURCE,INTEGRATIONID,SLOTDATE,6 SLOT,SLOT6
FROM T
UNION ALL
SELECT DATASOURCE,INTEGRATIONID,SLOTDATE,7 SLOT,SLOT7
FROM T
UNION ALL
SELECT DATASOURCE,INTEGRATIONID,SLOTDATE,8 SLOT,SLOT8
FROM T
UNION ALL
SELECT DATASOURCE,INTEGRATIONID,SLOTDATE,9 SLOT,SLOT9
FROM T
UNION ALL
SELECT DATASOURCE,INTEGRATIONID,SLOTDATE,10 SLOT,SLOT10
FROM T)
select DATASOURCE,INTEGRATIONID,SLOTDATE,slot,slot_value,min(slot) OVER (partition by datasource,integrationid,slotdate,rn) minslot,
max(slot) OVER (partition by datasource,integrationid,slotdate,rn) maxslot
FROM
select DATASOURCE,INTEGRATIONID,SLOTDATE,max(rn) over (partition by datasource,integrationid,slotdate order by slot) rn,slot,slot_value
FROM
(SELECT DATASOURCE,INTEGRATIONID,SLOTDATE,slot,slot_value,
case when row_number() over (partition by datasource,integrationid,slotdate order by slot) = 1 or
lag(slot_value) over (partition by datasource,integrationid,slotdate order by slot) <> slot_value
then row_number() over (partition by datasource,integrationid,slotdate order by slot)
ELSE null
END rn
from unpivoted
order by DATASOURCE,INTEGRATIONID,SLOTDATE,slot -
Can I set the min/max for multiple images at once?
I have brought in my page design from photoshop and I don't want any of the images or text to resize when the web browser window is made smaller.
Is there a way to do this without setting each min & max individually?I answered my own question in the end, I moved them to the parent background
-
Min/ Max interval data storage
OK, so what I am trying to do is scan 2 voltages at 3K, temporarily write that data to a file or buffer, read the min and max values, and log those to a file once per minute. I'm at the point where I can scan and display the data, but really don't know where to go next. Any thoughts or ideas would be much appreciated. Thanks
Attachments:
NI-6343-2CH VDC min-max.vi 45 KBYou only need a single loop. You can use the "elapsed time" express VI to signal when time has elapsed, and simply use a case structure to append the averages to the data before writing (in the false case just wire the current data across). You should also open the file before the loop, append inside the loop, and only close the file once the loop completes. You can use the min&max ptbypt VI to keep track of the min and max for each interval or just keep track of it using a shift register.
LabVIEW Champion . Do more with less code and in less time . -
DateTimeAxis min/max bug? Problems with consistent padding. Date Wrapping.
I have been working on a problem with a BarChart object that I've created using dynamic data.
My primary issue is that I can't seem to get the proper min/max values to set for the chart.
To solve this I manually found the min and max of the data set of Dates and set the min and max of the chart. This allowed me to finally see all the floating custom bars (each bar is rendered with a user set fill), however now if I have a bar that extends over a year change the horizontal axis labels do not wrap the date properly, so instead of 2/10 (feb 2010) being the last date, 12/09 (dec 2009) is the last date.
I've been trying to dynamically adjust the padding based upon a change event, but so far to no avail. Partially I think because I'm not sure which event for the function to fire on.
private function dateAxisGen(r:Array):void {
var min:Number = r[0].startTime.time;
var max:Number = r[0].endTime.time;
const PAD:Number = 2;
const MILLISEC_IN_MONTH:Number = 2629743830;
const MILLISEC_IN_WEEK:Number = 604800000;
const MILLISEC_IN_DAY:Number = 864;
for (var i:int = 1; i < r.length; i++) {
var o:OperationXT = OperationXT(r[i]);
min = Math.min(o.startTime.time, min);
max = Math.max(o.endTime.time, max);
// Calculates the maximum range, then adds an appropriate
// padding to the chart via extra time. TODO
/* var range:Number = max - min;
if(range >= MILLISEC_IN_MONTH) {
dAxis.padding = (MILLISEC_IN_WEEK/1000000)/PAD;
dAxis.padding = (MILLISEC_IN_WEEK/1000000)/PAD;
} else if(range >= MILLISEC_IN_WEEK) {
dAxis.padding = (MILLISEC_IN_DAY)/PAD;
dAxis.padding = (MILLISEC_IN_DAY)/PAD;
} else {
dAxis.padding = PAD;
dAxis.minimum = new Date(min);
dAxis.maximum = new Date(max);
this, however, does not adjust the padding properly when an operation is removed from the list. Not to mention I still have the date wrapping error. It gives me the following error:
Cannot access a property or method of a null object reference.
at mx.charts::AxisRenderer/measureHorizontalGutters()[C:\work\flex\dmv_automation\projects\d atavisualisation\src\mx\charts\AxisRenderer.as:2244]
at mx.charts::AxisRenderer/calcRotationAndSpacing()[C:\work\flex\dmv_automation\projects\dat avisualisation\src\mx\charts\AxisRenderer.as:1858]
at mx.charts::AxisRenderer/adjustGutters()[C:\work\flex\dmv_automation\projects\datavisualis ation\src\mx\charts\AxisRenderer.as:1534]
at mx.charts.chartClasses::CartesianChart/updateAxisLayout()[C:\work\flex\dmv_automation\pro jects\datavisualisation\src\mx\charts\chartClasses\CartesianChart.as:2239]
at mx.charts.chartClasses::CartesianChart/updateDisplayList()[C:\work\flex\dmv_automation\pr ojects\datavisualisation\src\mx\charts\chartClasses\CartesianChart.as:1366]
at mx.core::UIComponent/validateDisplayList()[E:\dev\gumbo_beta2\frameworks\projects\framewo rk\src\mx\core\UIComponent.as:8065]
at mx.managers::LayoutManager/validateDisplayList()[E:\dev\gumbo_beta2\frameworks\projects\f ramework\src\mx\managers\LayoutManager.as:663]
at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\gumbo_beta2\frameworks\projects \framework\src\mx\managers\LayoutManager.as:736]
at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\gumbo_beta2\frameworks\ projects\framework\src\mx\managers\LayoutManager.as:1069]
Any help with my problem would be greatly appreciated.
ADDITIONAL INFO:
Alright, so I've discovered that the ONLY time the date wrapping error occurs is when the axis labels contain only the month and year, any other time it places it properly.
Does anyone know where I can report this bug?Perre wrote:I'm used to being able to pick one or a couple of songs and then adding it a specified playlist. Is this impossible in sonata?
It's clearly not impossible, just different than you expect. Create your playlist as you want it to appear in the Current tab (meaning don't dump every single song from your library in there, just the ones you want) and then save the playlist.
Perre wrote:And if I try to play the m3u file created (the one with every song listed) through freevo I get a message that the directory is empty. What am I doing wrong??
Look at save_absolute_paths_in_playlists in your mpd.conf. -
Can we use MRP to plan for FERT in-house produced with PIR's & has Min/Max
Hi SAP Guru's
I have a very critical issue from the client who wants to use MIN/ MAX stock values for planning its finished products (in-house produced)
<b>here is the details of the scenario</b>
Client recieves 2 Excel files every week from customer
<b>1st</b> file contains the Weekly Demand Forecast of FERT material for next 1 year and they upload it in MD61 as PIR's <u><b>BUT</b></u> this value is also <u><b>Inclusive</b></u> of Safety stock value (<b>ex: if weekly demand entered in MD61 as PIR is 50 and if safety stock value is 10, then actual demand is only 40)</b>
<b>2nd</b> file send contains only <b>safety stock values</b> (for ex in this case let it = <b>10</b>) to be maintained for the FERT materials
the client wants MRP to plan and trigger based on this PIR's in MD61 and Safety stock level fand plan for FERT, HALB and also ROH materials as defined in the BOM also taking into consideration the current WIP levels (Work in progress for any existing production orders currently being processed) based on the production Lead times values maintained
so what the client wants is they want to maintain 2 stock values, that is one least stock value and other higher value which if stock falls below this point, will trigger production based on the lead time and considering any WIP levels also
<b>(for ex in this case if PIR = 50 and safety stock is 10, MRP run result client wants is = 30 and NOT =40)</b>
so here are my questions
1. is this scenario feasible? use safety stock and min/max level for in-house produced finished which has demand PIRs in MD61 at the same time?
2. Also due to SOX complaince regulations, the client does not want to change the forecast values in MD61, so is it possible to make some settings so that forecast is corrected by WIThOUT including the safety stock value in it? ( for ex: in this case as = 40 only and NOt as 50)
3. which all settings should i maintain like for MRP type or lot size or stock qty levels or anyother customizations if any required so that when we run MRP, can it ignore the safety stock value and generate the client desired output?
thank u verymuch for your time & expert advice in advanceHi Chakri,
This is not possible as per standard functionality. MRP always creates proposals for the shortage quantity of the safety stock. We have used the user exit in the plant level MRP run to exclude both plant and safety stock in the net requirements calculation.
You have to write logic to convert the safety stock into plant stock in the user exit so there will be no additional procurement proposals...you can create custom indicatar in materail master or linked any existing indicator like MRP group to the user exits so the MRP will checks this and will not create proposals for the selected parts.
If you have any questions then please inform.
Regards
TAJUDDIN -
I have a Power Mac G5 - How can I run Matrox MX02 mini max
I have a Power Mac G5 Running Mac OSX 10.5.8 I recently got the MX02 Mini Max by Matrox to run my Final Cut Studio application version 6.6 and Im having problems with the pci board that comes with the matrox unit ( it does not fit in the mother board) how would i be able to use this with out connecting the pci board into my mother board on my Mac.?
Can't use it with a G5.
System requirements are Mac Pro and Intel-based MacBook Pro running Mac OS X Leopard 10.5.6 or higher.
IF (big if) the card is PPC Mac compatible, only Late 2005 G5 machines have PCIe. All other G5s are PCI.
The Matrox card is PCIe, not PCI. -
Vendor details for a Min Max requisitions
Hi All
When Min Max trigger some requisition interface lines, we need to get the vendor details also be populated,
What set up it need to get these. Because when I run a Min-Max planning report, I am not getting the vendor details.
What we have is we will be having a single item be with a single vendor and vendor site
Please help.In the General planning tab for Sourcing type is it mentioned as Supplier?
Is the use ASL flag in the Purchasing tab for the item enabled?
The supplier and site details are active?
The ASL for this item is still active ? (Check in the supplier line details in the ASL form)
My funtional guy says yes to all the above quries.
And also says All ASL have the sourcing rules assigned to the assignment set that is setup on the MRP: Default Sourcing Assignment Set profile, but this scenario is only for minmax
So this issues is only for MIN-MAX.Please let me know if any thing to be done in setup to automatically get the
vendor details into requistions lines of interface table based on items.
Edited by: 834095 on Mar 14, 2011 2:59 AM -
How to calculate min/max scan rate of PCI-MIO-16XE-50
My board: PCI-MIO-16XE-50 , 20MHz timebase
The min/max scan rate is0.00596-20K scan/s and the channel rate is 1.53-20Kchannels/s
How do they calculate these data?Hi May
Check out the knowledge base locate at http://digital.ni.com/public.nsf/websearch/EA4E306828AF05B586256B8F00661A8B?OpenDocument . I think it answers your question.
Serges Lemo
Applications Engineer
National Instruments -
Bug: combo_box doesn't support min, max, precision, or validate
Combo boxes don't support the min, max, precision, or validate properties, contrary to what the documentation states in "Lightroom SDK 3.0\API Reference\modules\LrView edit view properties.html".
Here's a test program that shows the problems:
local LrDialogs = import 'LrDialogs'
local LrView = import 'LrView'
local f = LrView.osFactory()
local text = f:static_text {}
local function validate (view, value)
text.title = "validate called from " .. view.label
return true, value, nil
end
LrDialogs.presentModalDialog {
title = "Test", contents = f:column {
text,
f:row {
f:static_text {title = "numeric:"},
f:edit_field {min = 1, max = 10, precision = 0}},
f:row {
f:static_text {title = "numeric:"},
f:combo_box {min = 1, max = 10, precision = 0,
items = {1, 2, 3}}},
f:row {
f:static_text {title = "validate:"},
f:edit_field {validate = validate,
label = "edit_field"}},
f:row {
f:static_text {title = "validate:"},
f:combo_box {validate = validate,
label = "combo_box", items = {1, 2, 3}}}}}
I've reported this via the Web form.See also
http://forums.adobe.com/thread/675142. -
Hi all.
I have installed firefox 4 and i have an issue which for start i dont know if it is supposed to be so or not.
When i maximize firefox ,Navigation bar is mixed (shown below) the orange button on the upleft of my screen.Also is shown below of the 3 windows buttons (min,max,close) of the windows 7 in the upperight of my screen.
Is this supposed to be so?
I also have some screenshots if you would like to see :
www.1dagios.com/firefox4-1.jpg
+
www.1dagios.com/firefox4-2.jpg
Thank you for your time reading this and excuse my lame English.
Regards,
The_Observer.Any news on this.
I think it has something to do with the add on : Tabgroups manager.
If i disable this add on then everything works normally.
Also when this add on is enabled my tabs are always below adress bar ,no matter what. -
Min Max Planning to replenish from a single sub inventory
I am new to this site but could certainly use some help in a problem I am having. I am on a team in the process of implement discrete manufacturing. Here is the problem I am having. I am trying to set up min/max replenishment to a specific sub inventory. We currently have a centralized fabricated (make parts) store room. From that store room we move parts to variuos supermarkets with in the factory. From the supermarkets parts are component picked or kan ban replenished. The problem that I am having is that I want the replenishment trigger back to the sheet metal fabrication area to come from the "Centralized Make" parts storeroom. It is currently adding up all the locations or sub inventories the part number resides in to include RIP. I am being told that there is no way to limit the trigger to a single sub inventory.
Sandeep, Thanks I was able to generate and run the report and it did look only that the specified sub inventory and suggested the reorder qty properly. After running the report under the item number it says "unable to generate requisition" How does the fabrication area get a signal to begin the fabrication process, create a discrete job or create a planne order or something? So far your recommendations have been right on target! Again thankyou.
-
Hi All,
I need help on the following -
I am running Min-Max planning to create WIP jobs. I want to -
1: Default WIP Start Date to Current Date. Currently WIP completion date is defaulted to current date. This causes WIP Start Date in Past Due which is unacceptable.
2: The WIP jobs are created with status 'Released'. I want this to be defaulted to 'Unreleased'.
Appreciate help on this.
Regards,
Yash
Edited by: Yash on Feb 10, 2012 2:23 PMHi Sandeep,
What I found out is the profile option 'INV: Minmax Reorder Approval' governs the status.
Now we have given resolution to set this at user level.
1: Purchase Planner will have this set to 'Pre Approved'
2: WIP Planner will have this set to 'Incomplete'
Regards,
Yash
Maybe you are looking for
-
A tela da Configuração do Grupo de item aparece fora da tela de acesso
Grupo, Gostaria de ajuda, o servidor do meu cliente caiu e estava usando o cadastramento do grupo de item, agora quando tento abrir ele pararece no alto sem poder ser inserido os cadastros, já tentei de todas as formas baixar a tela mais não tive suc
-
Hello, Requirement is like: when we do F110, payment should be done by Vendor and PO no. means Vendor1 PO no 1 RE document 1 for this three invoice document only one payment doc RE document 2
-
Batch No. within Outgoing Excise Invoice
Dear All, How can I get Batch No. of the Items within Outgoing Excise Invoice. Regards Hitesh Parsawala
-
Hi All, Can some one clear my doubt please 1. In CUP Roles section , If I have 2 systems connected( ex : DEV and QAT) to my server when I export the role tempalte and fill in the Role attributes bla bla and when I want to import this file back I can
-
Hi, What I want to do is pretty simple (but I just can't figure it out ). I want to connect an analog input to an analog output, but control this like a relay. For example, when switch is true, my pins are connected so the input on pin A gets passed