Select MAX Date
I have the following recordset that includes a Patient Identification Number along with a Date of Service:
PatientID DOS
====== ======
11111 1/1/2015
11111 1/5/2015
33333 1/3/2015
22222 1/2/2015
11111 2/1/2015
22222 1/1/2015
11111 1/2/2015
33333 2/10/2015
11111 2/11/2015
22222 1/1/2015
I need a query that shows the MAX DOS for each patient. For example:
PatientID DOS
====== ======
11111 2/11/2015
22222 1/2/2015
33333 2/10/2015
Is this possible?
Thanks.
t1 and t2 is alias for table
SELECT
PatientID ,( select max ( DOS ) from Patient as t2 where t2 . PatientID = t1.PatientID ) DOS
FROM
Patient as t1
group by PatientID
I only have one table in select and subselect
Uma imagem vale mais do que mil palavras, mas ocupa 3 mil vezes mais espaço em disco
Similar Messages
-
Select max date from a table with multiple records
I need help writing an SQL to select max date from a table with multiple records.
Here's the scenario. There are multiple SA_IDs repeated with various EFFDT (dates). I want to retrieve the most recent effective date so that the SA_ID is unique. Looks simple, but I can't figure this out. Please help.
SA_ID CHAR_TYPE_CD EFFDT CHAR_VAL
0000651005 BASE 15-AUG-07 YES
0000651005 BASE 13-NOV-09 NO
0010973671 BASE 20-MAR-08 YES
0010973671 BASE 18-JUN-10 NOHi,
Welcome to the forum!
Whenever you have a question, post a little sample data in a form that people can use to re-create the problem and test their ideas.
For example:
CREATE TABLE table_x
( sa_id NUMBER (10)
, char_type VARCHAR2 (10)
, effdt DATE
, char_val VARCHAR2 (10)
INSERT INTO table_x (sa_id, char_type, effdt, char_val)
VALUES (0000651005, 'BASE', TO_DATE ('15-AUG-2007', 'DD-MON-YYYY'), 'YES');
INSERT INTO table_x (sa_id, char_type, effdt, char_val)
VALUES (0000651005, 'BASE', TO_DATE ('13-NOV-2009', 'DD-MON-YYYY'), 'NO');
INSERT INTO table_x (sa_id, char_type, effdt, char_val)
VALUES (0010973671, 'BASE', TO_DATE ('20-MAR-2008', 'DD-MON-YYYY'), 'YES');
INSERT INTO table_x (sa_id, char_type, effdt, char_val)
VALUES (0010973671, 'BASE', TO_DATE ('18-JUN-2010', 'DD-MON-YYYY'), 'NO');
COMMIT;Also, post the results that you want from that data. I'm not certain, but I think you want these results:
` SA_ID LAST_EFFD
651005 13-NOV-09
10973671 18-JUN-10That is, the latest effdt for each distinct sa_id.
Here's how to get those results:
SELECT sa_id
, MAX (effdt) AS last_effdt
FROM table_x
GROUP BY sa_id
; -
Selecting max date for specific 'operation' code
I have the following scenario: a history table that keeps track of the 'operation' and the date of the operation. For example, the operation field can have a code of U (for update), C (for closed), O (for re-opened), A (for approved), etc.
The goal of this history table is to keep track of all of the modifications made. Hence, a particular record of interest can have more than one 'U' operation documented, C operation, etc.
How can I choose the max date for each operation.
I was diong the following in my PL/SQL:
BEGIN
SELECT operation_code, o_date, user INTO lv_operation_code, lv_date, lv_user FROM table1 WHERE unique_id = pv_id AND operation_code = U' AND o_date = (SELECT max(o_date) FROM table1 WHERE unique_code = pv_id);
EXCEPTION
WHEN NO_DATA_FOUND THEN NULL;
END;
I then have another begin statement for the 'C' operation, etc.Hi,
OraclePolzovatel wrote:
... I was diong the following in my PL/SQL:
BEGIN
SELECT operation_code, o_date, user INTO lv_operation_code, lv_date, lv_user FROM table1 WHERE unique_id = pv_id AND operation_code = U' AND o_date = (SELECT max(o_date) FROM table1 WHERE unique_code = pv_id);
EXCEPTION
WHEN NO_DATA_FOUND THEN NULL;
END;
I then have another begin statement for the 'C' operation, etc.Are you sure that's what you're doing? There seem to be errors, such as unmatched quotes.
Instead of doing a single SELECT with something like "operation_code = 'U'" in the WHERE-clause, you could write a cursor with "GROUP BY operation_code". -
SQL Command to select MAX(date) & Max(time)
My am having a really hard time getting a sql command to return data with the max(date) & max(time) combination. I think I need a sub query but can not figure it out. I have looked all over the internet but still don't understand it. Below is my command which returns the max date & max time but they are not from the same row of data. Please help.
SELECT "labor"."order-no", "labor"."oper-no", MAX("labor"."end-date") AS myDate, Max("labor"."end-time") AS myTime
FROM "E940LIVE"."PUB"."tm-log" "labor"
WHERE "labor"."order-no"='73153-bc' AND "labor"."company"='01'
GROUP BY "labor"."order-no", "labor"."oper-no"Progress does not support the DATEADD function. Waht if I forget the number is time and look at it just as a number. Here is my data and what I have tried (again I don't understand the multiple select concept yet).
Data
oper-no end-date end-time
20 2/2/2010 41,975
30 2/3/2010 45,906
30 2/16/2010 32,941
40 2/4/2010 46,099
40 2/4/2010 50,227
40 2/4/2010 59,466
40 2/4/2010 62,024
40 2/16/2010 43,838
60 2/17/2010 32,679
90 2/25/2010 35,270
SQL Command
SELECT a."oper-no", a."end-time", a."end-date"
FROM "E940LIVE"."PUB"."tm-log" a, (SELECT "end-time", max("end-date") AS max_date FROM "E940LIVE"."PUB"."tm-log" WHERE "order-no"='73153-bc' AND "company"='01' GROUP BY "end-date", "end-time") b
WHERE a."end-time" = b."end-time" AND a."end-date" = b.max_date AND a."order-no"='73153-bc' AND a."company"='01'
Result
oper-no end-date end-time
20 2/2/2010 41,975
30 2/3/2010 45,906
40 2/4/2010 50,227
40 2/4/2010 46,099
40 2/4/2010 59,466
40 2/4/2010 62,024
30 2/16/2010 32,941
40 2/16/2010 43,838
60 2/17/2010 32,679
90 2/25/2010 35,270
Desired Result
oper-no end-date end-time
20 2/2/2010 41,975
30 2/16/2010 32,941
40 2/16/2010 43,838
60 2/17/2010 32,679
90 2/25/2010 35,270
Thanks for any and all help!
Wayne -
Hi,
I need help with a Select statement that returns the most recent revision date from an Oracle database.
This is my Select statement:
SELECT
STORE.ITEM.ID,
STORE.ITEM.ITEM_NUMBER,
STORE.ITEM.CATEGORY,
STORE.ITEM.DESCRIPTION,
STORE.REV.REV_NUMBER,
STORE.REV.OBSOLETE_DATE,
STORE.REV.RELEASE_DATE
FROM
STORE.ITEM,
STORE.REV
WHERE
STORE.ITEM.ID = STORE.REV.ITEM AND
(STORE.REV.OBSOLETE_DATE IS NULL) AND
(STORE.ITEM.ITEM_NUMBER = '100.009')
ORDER BY
STORE.REV.RELEASE_DATE DESC
The result is:
4295110 100.009 207531 Widget001 07 NULL 10/20/2006 11:33:33 AM <-------------- Would like to have only this one item
4295110 100.009 207531 Widget001 06 NULL 9/20/2005 7:57:26 AM
4295110 100.009 207531 Widget001 05 NULL 11/13/2003 9:17:35 AM
4295110 100.009 207531 Widget001 04 NULL 11/19/2001 12:10:25 PM
4295110 100.009 207531 Widget001 03 NULL 3/21/2001 1:01:07 PM
4295110 100.009 207531 Widget001 2 NULL 2/6/1999 10:55:19 AM
Could someone please help me get the item with the most recent STORE.REV.RELEASE_DATE.
Thanks.SQL> create table item (id,item_number,category,description)
2 as
3 select 4295110, '100.009', 207531, 'widget001' from dual
4 /
Tabel is aangemaakt.
SQL> create table rev (item,rev_number,obsolete_date,release_date)
2 as
3 select 4295110, '07', null, to_date('10/20/2006 11:33:33 AM','mm/dd/yyyy hh:mi:ss am') from dual union all
4 select 4295110, '06', null, to_date('09/20/2005 7:57:26 AM','mm/dd/yyyy hh:mi:ss am') from dual union all
5 select 4295110, '05', null, to_date('11/13/2003 9:17:35 AM','mm/dd/yyyy hh:mi:ss am') from dual union all
6 select 4295110, '04', null, to_date('11/19/2001 12:10:25 PM','mm/dd/yyyy hh:mi:ss am') from dual union all
7 select 4295110, '03', null, to_date('3/21/2001 1:01:07 PM','mm/dd/yyyy hh:mi:ss am') from dual union all
8 select 4295110, '2', null, to_date('2/6/1999 10:55:19 AM','mm/dd/yyyy hh:mi:ss am') from dual union all
9 select 4295110, '1', sysdate, to_date('2/6/1998 10:55:19 AM','mm/dd/yyyy hh:mi:ss am') from dual
10 /
Tabel is aangemaakt.
SQL> select item.id
2 , item.item_number
3 , item.category
4 , item.description
5 , max(rev_number) keep (dense_rank last order by release_date)
6 , max(obsolete_date) keep (dense_rank last order by release_date)
7 , max(release_date)
8 from item
9 , rev
10 where item.id = rev.item
11 and rev.obsolete_date is null
12 and item.item_number = '100.009'
13 group by item.id
14 , item.item_number
15 , item.category
16 , item.description
17 /
ID ITEM_NU CATEGORY DESCRIPTI MA MAX(OBSOLETE_DATE)K MAX(RELEASE_DATE)
4295110 100.009 207531 widget001 07 20-10-2006 11:33:33
1 rij is geselecteerd.Regards,
Rob. -
Select max date from a group of columns of type date
hi ,
my requirement is i have 5 columns
ID, date1,date2,date3,date4.
first column is integer type and is primary key and remaining all columns are type DATE
the values in the table are for example:
ID date1 date2 date3 date4
100 8/19/2007 4:29:44 PM 8/18/2007 3:50:34 PM 8/16/2007 3:20:55 PM 8/20/2007 5:19:24 PM
101 8/21/2007 5:29:44 PM 8/19/2007 4:20:34 PM 8/19/2007 4:29:44 PM 8/18/2007 2:50:45 PM
the output required is
ID closeddate
100 8/20/2007 5:19:24 PM
101 8/21/2007 5:29:44 PM
i want the max of all dates in all date columns in one single column for each row
the query which i tried is
select ID,max(closed_date)
from t1,TABLE(Date(date1,date2,date3,date4)) closeddate
but its not working
can any body help me out in solving this
thanks in advanceso use the NVL on each column. and set it to
something ridiculous, so it will always be less than
the other values. and then, if the ridiculous value
shows up, it means all the columns were null for that
row.Rather than relying on some rediculously small date use coalecse on each date column with the date column of intereste listed first. The order of the remaining terms in the coalesce statement is unimportant. e.g. on a table with three date columsn:
with x as (
select 1 id, sysdate dte1, sysdate-1 dte2, sysdate+1 dte3 from dual union
select 2, sysdate, null, null from dual union
select 3, null, sysdate-1, null from dual union
select 4, null, sysdate-1, sysdate+1 from dual union
select 5, null, null, null from dual
select id,
greatest( coalesce(dte1,dte2,dte3),
coalesce(dte2,dte3,dte1),
coalesce(dte3,dte1,dte2)) Max_Date
from x
ID MAX_DATE
1 09-OCT-2007 12.15.44
2 08-OCT-2007 12.15.44
3 07-OCT-2007 12.15.44
4 09-OCT-2007 12.15.44
5 (null)
5 rows selecteThis way if they are all null, you get a null result, and don't need to handle your null value date as a special case. It also avoids the situation where the unlikely event occurs where your special null value date appears as actual data. -
How to select maximum date in report
i have tried to select maximum date in my report by this way:
select max(date) from a
but the result came out same as "select date from a"
there is no different whether i put a max or not. is anyone there can help me on this please....
Thank you....Hi Sharon,
Since you cannot execute this query from SQL, I assume that the DB does not support the function MAX(expr). Am not sure which DB versions support this function, probably the Database forum will be a better place to ask that.
As a workaround, what you could try is to use this statement
select hire_date from employees order by hire_date desc
and in the report data model, you make a summary column and choose Function > First, Source > Hire_Date, and Reset At > Report.
Hope that helps.
Navneet. -
Hi
How can I to get the max Date in each day in data below , I must to do in unique query
select to_date('1/6/2010 06:29:04','dd/mm/yyyy hh24:mi:ss') DATA from dual union
select to_date('1/6/2010 06:29:04','dd/mm/yyyy hh24:mi:ss') DATA from dual union
select to_date('1/6/2010 06:28:03','dd/mm/yyyy hh24:mi:ss') DATA from dual union
select to_date('1/6/2010 06:27:58','dd/mm/yyyy hh24:mi:ss') DATA from dual union
select to_date('1/6/2010 06:27:57','dd/mm/yyyy hh24:mi:ss') DATA from dual union
select to_date('1/6/2010 06:27:57','dd/mm/yyyy hh24:mi:ss') DATA from dual union
select to_date('1/6/2010 06:27:52','dd/mm/yyyy hh24:mi:ss') DATA from dual union
select to_date('1/6/2010 06:27:45','dd/mm/yyyy hh24:mi:ss') DATA from dual union
select to_date('1/6/2010 06:12:48','dd/mm/yyyy hh24:mi:ss') DATA from dual union
select to_date('1/6/2010 06:12:43','dd/mm/yyyy hh24:mi:ss') DATA from dual union
select to_date('1/6/2010 06:12:43','dd/mm/yyyy hh24:mi:ss') DATA from dual union
select to_date('1/6/2010 06:12:42','dd/mm/yyyy hh24:mi:ss') DATA from dual union
select to_date('1/6/2010 06:12:41','dd/mm/yyyy hh24:mi:ss') DATA from dual union
select to_date('1/6/2010 06:12:41','dd/mm/yyyy hh24:mi:ss') DATA from dual union
select to_date('1/6/2010 06:09:53','dd/mm/yyyy hh24:mi:ss') DATA from dual UNION
select to_date('31/05/2010 06:39:04','dd/mm/yyyy hh24:mi:ss') DATA from dual union
select to_date('31/05/2010 06:38:04','dd/mm/yyyy hh24:mi:ss') DATA from dual union
select to_date('31/05/2010 06:37:03','dd/mm/yyyy hh24:mi:ss') DATA from dual union
select to_date('31/05/2010 06:37:02','dd/mm/yyyy hh24:mi:ss') DATA from dual union
select to_date('31/05/2010 06:36:57','dd/mm/yyyy hh24:mi:ss') DATA from dual union
select to_date('31/05/2010 06:36:56','dd/mm/yyyy hh24:mi:ss') DATA from dual union
select to_date('31/05/2010 06:27:52','dd/mm/yyyy hh24:mi:ss') DATA from dual union
select to_date('31/05/2010 06:27:45','dd/mm/yyyy hh24:mi:ss') DATA from dual union
select to_date('31/05/2010 06:12:48','dd/mm/yyyy hh24:mi:ss') DATA from dual union
select to_date('31/05/2010 06:12:43','dd/mm/yyyy hh24:mi:ss') DATA from dual union
select to_date('31/05/2010 06:12:43','dd/mm/yyyy hh24:mi:ss') DATA from dual union
select to_date('31/05/2010 06:12:42','dd/mm/yyyy hh24:mi:ss') DATA from dual union
select to_date('31/05/2010 06:12:41','dd/mm/yyyy hh24:mi:ss') DATA from dual union
select to_date('31/05/2010 06:12:41','dd/mm/yyyy hh24:mi:ss') DATA from dual union
select to_date('31/05/2010 06:09:53','dd/mm/yyyy hh24:mi:ss') DATA from dual
ORDER BY 1 DESCUsing Oracle 9.2.02
TIAAlso possible if you need all the days bettween your first and last day.
with tab as (
select to_date('1/6/2010 06:29:04','dd/mm/yyyy hh24:mi:ss') DATA from dual union all
select to_date('1/6/2010 06:29:04','dd/mm/yyyy hh24:mi:ss') DATA from dual union all
select to_date('1/6/2010 06:28:03','dd/mm/yyyy hh24:mi:ss') DATA from dual union all
select to_date('1/6/2010 06:27:58','dd/mm/yyyy hh24:mi:ss') DATA from dual union all
select to_date('1/6/2010 06:27:57','dd/mm/yyyy hh24:mi:ss') DATA from dual union all
select to_date('1/6/2010 06:27:57','dd/mm/yyyy hh24:mi:ss') DATA from dual union all
select to_date('1/6/2010 06:27:52','dd/mm/yyyy hh24:mi:ss') DATA from dual union all
select to_date('1/6/2010 06:27:45','dd/mm/yyyy hh24:mi:ss') DATA from dual union all
select to_date('1/6/2010 06:12:48','dd/mm/yyyy hh24:mi:ss') DATA from dual union all
select to_date('1/6/2010 06:12:43','dd/mm/yyyy hh24:mi:ss') DATA from dual union all
select to_date('1/6/2010 06:12:43','dd/mm/yyyy hh24:mi:ss') DATA from dual union all
select to_date('1/6/2010 06:12:42','dd/mm/yyyy hh24:mi:ss') DATA from dual union all
select to_date('1/6/2010 06:12:41','dd/mm/yyyy hh24:mi:ss') DATA from dual union all
select to_date('1/6/2010 06:12:41','dd/mm/yyyy hh24:mi:ss') DATA from dual union all
select to_date('1/6/2010 06:09:53','dd/mm/yyyy hh24:mi:ss') DATA from dual UNION all
select to_date('31/05/2010 06:39:04','dd/mm/yyyy hh24:mi:ss') DATA from dual union all
select to_date('31/05/2010 06:38:04','dd/mm/yyyy hh24:mi:ss') DATA from dual union all
select to_date('31/05/2010 06:37:03','dd/mm/yyyy hh24:mi:ss') DATA from dual union all
select to_date('31/05/2010 06:37:02','dd/mm/yyyy hh24:mi:ss') DATA from dual union all
select to_date('31/05/2010 06:36:57','dd/mm/yyyy hh24:mi:ss') DATA from dual union all
select to_date('31/05/2010 06:36:56','dd/mm/yyyy hh24:mi:ss') DATA from dual union all
select to_date('31/05/2010 06:27:52','dd/mm/yyyy hh24:mi:ss') DATA from dual union all
select to_date('31/05/2010 06:27:45','dd/mm/yyyy hh24:mi:ss') DATA from dual union all
select to_date('31/05/2010 06:12:48','dd/mm/yyyy hh24:mi:ss') DATA from dual union all
select to_date('31/05/2010 06:12:43','dd/mm/yyyy hh24:mi:ss') DATA from dual union all
select to_date('31/05/2010 06:12:43','dd/mm/yyyy hh24:mi:ss') DATA from dual union all
select to_date('31/05/2010 06:12:42','dd/mm/yyyy hh24:mi:ss') DATA from dual union all
select to_date('31/05/2010 06:12:41','dd/mm/yyyy hh24:mi:ss') DATA from dual union all
select to_date('31/05/2010 06:12:41','dd/mm/yyyy hh24:mi:ss') DATA from dual union all
select to_date('31/05/2010 06:09:53','dd/mm/yyyy hh24:mi:ss') DATA from dual union all
select to_date('28/05/2010 02:09:53','dd/mm/yyyy hh24:mi:ss') DATA from dual
,maxmin as (select trunc(min(data)) mindat, trunc(max(data)) maxdat, trunc(max(data))-trunc(min(data))+1 no_of_days from tab)
,days as (select rownum + (select mm2.mindat from maxmin mm2) - 1 dy
from all_objects ao
where rownum <= (select mm1.no_of_days from maxmin mm1))
select d.dy, (select max(data) from tab where trunc(data) = d.dy) max_time
from days d
dy max_time
28.05.10 00:00:00 28.05.10 02:09:53
29.05.10 00:00:00
30.05.10 00:00:00
31.05.10 00:00:00 31.05.10 06:39:04
01.06.10 00:00:00 01.06.10 06:29:04 -
Query to select value for max date from a varchar field containing year and month
I'm having trouble selecting a value from a table that contain a varchar column in YYYY-MM format.
ex.
Emp_id Date Cost
10264 2013-01 5.00
33644 2013-12 84.00
10264 2013-02 12.00
33644 2012-01 680.0
59842 2014-05 57.00
In the sample data above, I would like to be able to select the for each Emp_id by the max date. Ex. For Emp_id 10264, the cost should be 12.00.create table test (Emp_id int, Date varchar(10), Cost decimal (6,2))
insert into test values(
10264, '2013-01', 5.00 ),
(33644, '2013-12', 84.00 ),
(10264, '2013-02', 12.00 ),
(33644, '2012-01', 680.0 ),
(59842, '2014-05', 57.00 )
Select Emp_id,[Date],Cost FROM (
select *,row_number() Over(Partition by Emp_id Order by Cast([Date]+'-1' as Datetime) Desc) rn
from test)
t
WHERE rn=1
drop table test -
Compare Dates and select the max date ?
Hello,
I am trying to write a script and will compare the dates in " eff_startdt" and give me the lastest date at the outcome.
I have data that some service locations have more than one contract date and I need to get the latest dated conract dates to work on the data but I tried many things I am always getting errors. When I run the script below I get " missing expression" error. I dont' see anything missing.
also somehow Max() is keep giving me errors when I do something like [ ON service_locs = vmeterid WHERE SERVICE_LOCS = SERVICE_LOCS AND EFF_STARTDT = MAX(EFF_STARTDT) ]
Can someone pls give me advice on this. Thanks
SELECT DISTINCT Broker, customer_name, service_locs, fee_kwh, qtr_monthly, eff_startdt, eff_enddt
FROM VMETER
INNER JOIN BROKER_DATA
ON service_locs = vmeterid WHERE SERVICE_LOCS = SERVICE_LOCS AND (SELECT MAX(EFF_STARTDT) FROM VMETER)
-----------------------------------------------------------Hi,
I will try to explain on my example. I have got a table:
DESC SOLD_ITEMS;
Name Value NULL? Type
COMPONENT VARCHAR2(255)
SUBCOMPONENT VARCHAR2(255)
YEAR NUMBER(4)
MONTH NUMBER(2)
DAY NUMBER(2)
DEFECTS NUMBER(10)
DESCRIPTION VARCHAR2(200)
SALE_DATE DATE
COMP_ID NUMBERI have insert example data into my table:
select component, subcomponent, sale_date,comp_id
2 from sold_items;
COMPONENT SUBCOMPONENT SALE_DAT COMP_ID
graph bar 06/04/03 1
graph bar 06/04/01 2
search user search 06/04/02 3
search user search 06/04/01 4
search product search 06/03/20 5
search product search 06/03/16 6
graph bar 06/05/01 7
graph bar 06/05/02 8
graph bar 06/05/02 9
As you can see there are a few components and subcomponents duplicated with different date and comp_id value.
I want to get component and subcomponent combination with latest date.
SELECT COMPONENT, SUBCOMPONENT, MAX(SALE_DATE)
2 FROM SOLD_ITEMS
3* GROUP BY COMPONENT, SUBCOMPONENT;
Efect:
COMPONENT SUBCOMPONENT MAX(SALE
graph bar 06/05/02
search user search 06/04/02
search product search 06/03/20
For your purpose I will do it using join and subquery. Maybe it will help you resolve your problem:
SELECT COMPONENT, SUBCOMPONENT, SALE_DATE, RANK
2 FROM (SELECT T1.COMPONENT, T1.SUBCOMPONENT, T2.SALE_DATE,
3 ROW_NUMBER() OVER (PARTITION BY T1.COMPONENT, T2.SUBCOMPONENT ORDER BY T2.SALE_DATE DESC) AS ROW
4 FROM SOLD_ITEMS T1, SOLD_ITEMS T2
5 WHERE T1.COMP_ID = T2.COMP_ID)
6* WHERE ROW = 1;
I joined the same table but it act as two different tables inside subquery. It will group values (partition by statement) and order result descending using t2.sale_date column. As you can see columns are returned from both tables. If you would like to add some conditions, you can do it after WHERE ROW=1 code.
Results:
COMPONENT SUBCOMPONENT SALE_DAT RANK
graph bar 06/05/02 1
search product search 06/03/20 1
search user search 06/04/02 1Hope this help you
Peter D. -
Problem selecting MAX YEAR MAX MONTH MAX DATE in one query
CREATE TABLE TEMP
C_INVOICE_ID NUMBER(10),
DIA NUMBER,
MES NUMBER,
ANO NUMBER,
SOCIO_NEGOCIO NVARCHAR2(60) NOT NULL,
PRODUCTO_NOM NVARCHAR2(60) NOT NULL,
M_PRODUCT_ID NUMBER(10),
CATEGORIA NVARCHAR2(60) NOT NULL,
COSTO NUMBER
INSERT INTO TEMP VALUES(10111,1,2,2010,'1585','ALURON 100MG X 30 TABLETAS',1530,15,1.15);
INSERT INTO TEMP VALUES(1015,15,2,2010,'1520','ALURON 100MG X 30 TABLETAS',1530,15,2.15);
INSERT INTO TEMP VALUES(5654,5,2,2010,'1520','AMARYL 2MG X 15 TABLETAS',1531,15,4.2);
INSERT INTO TEMP VALUES(15321,4,6,2010,'1520','AMARYL 2MG X 15 TABLETAS',1531,15,4.8);
INSERT INTO TEMP VALUES(13548,8,6,2010,'1585','AMARYL 2MG X 15 TABLETAS',1531,15,4.3);
INSERT INTO TEMP VALUES(19456,31,4,2010,'1220','AMARYL 2MG X 15 TABLETAS',1531,15,4);
INSERT INTO TEMP VALUES(116544,8,8,2010,'1220','AMARYL 2MG X 15 TABLETAS',1531,15,4.8);
INSERT INTO TEMP VALUES(132,2,3,2010,'1220','AMARYL 2MG X 15 TABLETAS',1531,15,4.1);
INSERT INTO TEMP VALUES(168,15,1,2010,'1220','AMARYL 2MG X 15 TABLETAS',1531,15,4.9);
INSERT INTO TEMP VALUES(4898,7,4,2010,'1220','AMOXAL 250MG X 75ML SUSPENSION',1534,15,3.8);
INSERT INTO TEMP VALUES(15132,25,9,2010,'1585','AMOXAL 250MG X 75ML SUSPENSION',1534,15,3.4);
INSERT INTO TEMP VALUES(1684,18,8,2010,'1585','AMOXAL 250MG X 75ML SUSPENSION',1534,15,3.3);
INSERT INTO TEMP VALUES(14988,8,8,2010,'1585','AMOXAL 250MG X 75ML SUSPENSION',1534,15,2.9);
INSERT INTO TEMP VALUES(84941,8,9,2010,'1585','AMOXAL 250MG X 75ML SUSPENSION',1534,15,4.1);
INSERT INTO TEMP VALUES(1155,7,4,2010,'1585','AMOXAL 250MG X 75ML SUSPENSION',1534,15,4.7);
INSERT INTO TEMP VALUES(184,1,1,2010,'1520','AMOXAL 250MG X 75ML SUSPENSION',1534,15,3.9);
INSERT INTO TEMP VALUES(48994,8,4,2010,'1520','AMOXAL 250MG X 75ML SUSPENSION',1534,15,3.7);
INSERT INTO TEMP VALUES(1465465,9,5,2009,'1520','AMOXAL 250MG X 75ML SUSPENSION',1534,15,3.8);
INSERT INTO TEMP VALUES(16,18,6,2009,'1520','AMOXAL 250MG X 75ML SUSPENSION',1534,15,3.9);
INSERT INTO TEMP VALUES(894886,20,4,2009,'1520','AMOXAL 250MG X 75ML SUSPENSION',1534,15,3.9);
CREATE TABLE TEMP
C_INVOICE_ID NUMBER(10),
DIA NUMBER,
MES NUMBER,
ANO NUMBER,
SOCIO_NEGOCIO NVARCHAR2(60) NOT NULL,
PRODUCTO_NOM NVARCHAR2(60) NOT NULL,
M_PRODUCT_ID NUMBER(10),
CATEGORIA NVARCHAR2(60) NOT NULL,
COSTO NUMBER
INSERT INTO TEMP VALUES(10111,1,2,2010,'1585','ALURON 100MG X 30 TABLETAS',1530,15,1.15);
INSERT INTO TEMP VALUES(1015,15,2,2010,'1520','ALURON 100MG X 30 TABLETAS',1530,15,2.15);
INSERT INTO TEMP VALUES(5654,5,2,2010,'1520','AMARYL 2MG X 15 TABLETAS',1531,15,4.2);
INSERT INTO TEMP VALUES(15321,4,6,2010,'1520','AMARYL 2MG X 15 TABLETAS',1531,15,4.8);
INSERT INTO TEMP VALUES(13548,8,6,2010,'1585','AMARYL 2MG X 15 TABLETAS',1531,15,4.3);
INSERT INTO TEMP VALUES(19456,31,4,2010,'1220','AMARYL 2MG X 15 TABLETAS',1531,15,4);
INSERT INTO TEMP VALUES(116544,8,8,2010,'1220','AMARYL 2MG X 15 TABLETAS',1531,15,4.8);
INSERT INTO TEMP VALUES(132,2,3,2010,'1220','AMARYL 2MG X 15 TABLETAS',1531,15,4.1);
INSERT INTO TEMP VALUES(168,15,1,2010,'1220','AMARYL 2MG X 15 TABLETAS',1531,15,4.9);
INSERT INTO TEMP VALUES(4898,7,4,2010,'1220','AMOXAL 250MG X 75ML SUSPENSION',1534,15,3.8);
INSERT INTO TEMP VALUES(15132,25,9,2010,'1585','AMOXAL 250MG X 75ML SUSPENSION',1534,15,3.4);
INSERT INTO TEMP VALUES(1684,18,8,2010,'1585','AMOXAL 250MG X 75ML SUSPENSION',1534,15,3.3);
INSERT INTO TEMP VALUES(14988,8,8,2010,'1585','AMOXAL 250MG X 75ML SUSPENSION',1534,15,2.9);
INSERT INTO TEMP VALUES(84941,8,9,2010,'1585','AMOXAL 250MG X 75ML SUSPENSION',1534,15,4.1);
INSERT INTO TEMP VALUES(1155,7,4,2010,'1585','AMOXAL 250MG X 75ML SUSPENSION',1534,15,4.7);
INSERT INTO TEMP VALUES(184,1,1,2010,'1520','AMOXAL 250MG X 75ML SUSPENSION',1534,15,3.9);
INSERT INTO TEMP VALUES(48994,8,4,2010,'1520','AMOXAL 250MG X 75ML SUSPENSION',1534,15,3.7);
INSERT INTO TEMP VALUES(1465465,9,5,2009,'1520','AMOXAL 250MG X 75ML SUSPENSION',1534,15,3.8);
INSERT INTO TEMP VALUES(16,18,6,2009,'1520','AMOXAL 250MG X 75ML SUSPENSION',1534,15,3.9);
INSERT INTO TEMP VALUES(894886,20,4,2009,'1520','AMOXAL 250MG X 75ML SUSPENSION',1534,15,3.9);
I have this query so far,
SELECT
MAX (TEMP.COSTO) COSTO,
TEMP.M_PRODUCT_ID,
TEMP.ANO
FROM TEMP TEMP
INNER JOIN(
SELECT MAX(ANO) ANO, M_PRODUCT_ID
FROM TEMP I
GROUP BY M_PRODUCT_ID
) LA ON LA.ANO = TEMP.ANO AND LA.M_PRODUCT_ID = TEMP.M_PRODUCT_ID
GROUP BY
TEMP.M_PRODUCT_ID,
TEMP.ANO
but my intention is not to have the max cost, my intention is to query in this order
first i need to select distinct m_product_id then
for every m_product_id i need to
filter max (ano) then filter max (mes) then filter max (dia)
I need the result set like this.
C_INVOICE_ID DIA MES ANO SOCIO PRODUCTO_NOM M_PRODUCT_ID CATERGORIA COSTO
1015 15 2 2010 1520 ALURON 100MG X 30 TABLETAS 1530 15 2.15
5654 5 2 2010 1520 AMARYL 2MG X 15 TABLETAS 1531 15 4.2
15132 25 9 2010 1585 AMOXAL 250MG X 75ML SUSPENSION 1534 15 3.4
please i really apritiated any help, thanks pd:i'm using oracle 9iHi,
Thanks for posting the CREATE TABLE and INSERT statements. Why are there two tables, and two sets of data? Was that a mistake?
Sorry, I don't uderstand the problem.
For m_product_id=1531, for example, why do you want
INSERT INTO TEMP VALUES(5654, 5, 2, 2010,'1520','AMARYL 2MG X 15 TABLETAS',1531,15,4.2);selected, and not
INSERT INTO TEMP VALUES(116544, 8, 8, 2010,'1220','AMARYL 2MG X 15 TABLETAS',1531,15,4.8);Both rows have ano=2010, so don't you want the one with the higher mes (8 > 2)?
I think what you'll want is a Top-N Query , something like this:
WITH got_r_num AS
SELECT temp.* -- or list columns you want
, RANK () OVER ( PARTITION BY m_product_id
ORDER BY ano DESC NULLS FIRST
, mes DESC NULLS FIRST
, dia DESC NULLS FIRST
) AS r_num
FROM temp
-- WHERE ... -- any filtering goes here
SELECT * -- or list all columns except r_num
FROM got_r_num
WHERE r_num = 1
;What if there's a tie? For example, if you add another row to the sample data:
INSERT INTO TEMP VALUES(9876, 15,2, 2010,'1520','ALURON 100MG X 30 TABLETAS',1530,15,2.15);The query above would include both c_invoice_id=9876 and 1015. If you want just one of those rows, add more expressions to the analytic ORDER BY clause and/or use ROW_NUMBER instead of RANK. -
Max date in Default selection of prompt
HI,
in Prompt i have dates,i need maximum date in default selction of prompt
how to give max("table"."colum")You have to write query like
SELECT MAX(Time.Date) saw_0 FROM "SA"
at Prompt->Show->SQL Results use this query
If helps pls mark as correct/helpful
Edited by: Veeravalli on Nov 22, 2012 6:33 AM -
I'm trying to select the row from a table that has the maximum date. For example, lets say I want the name of the most recently created object in dba_objects. I can do this using a sub-query, but surely there must be an easier way, and querying this way doesn't account for the possibility of two things being created at the exact same time.
I would assume there must be some way of achieving the same result using the HAVING clause, but I can't figure it out right now (it is Monday morning after all).
Any ideas?
SELECT object_id, object_name, created
FROM dba_objects
WHERE created = (
SELECT MAX(created)
FROM dba_objects)
/sql>
SELECT max(object_name) keep(dense_rank first order by created desc) ob_name, max(created) created
FROM user_objects
OB_NAME CREATED
PROMETRIC_SLOTS_PK 04-JAN-07
Message was edited by:
Without subquery
jeneesh -
Select previous max(date) and current max(date) in trigger
Good mroning fellows!
I am trying to develop a row level trigger that inserts data into another table after insert.
Within the trigger I need to calculate a couple of averages based on dates. Therefore I need to select the date of the previously entered record and calculate the days between this last record and the current entry that was just saved.
Is it possible to write it like that in the trigger?
create or replace
TRIGGER borki.set_tageswerte
AFTER INSERT
ON borki.fangzahlen
FOR EACH ROW
-- WHEN (NEW.qb_nr > 0 AND NEW.lrt_fl_id > 0)
DECLARE
old_date date;
latest_date date;
days number;
avergae_amount integer;
BEGIN
old_date := (SELECT max(:old.date_datum)
FROM borki.fangzahlen
WHERE lng_falle = :new.lng_falle
AND int_fallennummer = :new.int_fallennummer
AND lng_schaedling = :new.lng_schaedling);
latest_date := (SELECT max(:new.date_datum)
FROM borki.fangzahlen
WHERE lng_falle = :new.lng_falle
AND int_fallennummer = :new.int_fallennummer
AND lng_schaedling = :new.lng_schaedling);
days := latest_date - old_date;
average_amount := (SELECT CASE
WHEN f.int_volumen > 0 AND f.lng_schaedling = 1 THEN f.int_volumen * 40
WHEN f.int_volumen > 0 AND f.lng_schaedling = 2 THEN f.int_volumen * 550
WHEN f.int_anzahl > 0 THEN f.int_anzahl
END
/ days AS tagesfang
FROM borki.fangzahlen f
WHERE f.lng_falle = :new.lng_falle
AND f.int_fallennummer = :new.int_fallennummer
AND f.lng_schaedling = :new.lng_schaedling
AND days > 0
AND ((f.int_anzahl > 0) OR (f.int_volumen > 0)))
INSERT
INTO fangzahlen_tageswerte
lng_falle, date_datum, int_fallennummer, lng_schaedling, int_volumen, int_anzahl, lng_fangzahlen
VALUES
(SELECT f.lng_falle,
:new.date_datum, :new.int_fallennummer,
:new.lng_schaedling, :new.int_volumen,
:new.int_anzahl - ((y-1)*rec.tagesfang),
:new.objectid
END;thanks for sharing your wisdom mith me! :-)
Sebastian
Edited by: skahlert on 07.04.2010 07:04Hello Tubby!
You're correct!
I'll take the time and show you what I got and what I need!
I am working with an Apex frontend where users enter scientific data for beetle monitoring.
The data entered consists of --> date_datum: date when last trap was emptied
--> int_volumen: the volume of the trap (used to calculate found specimen when int_anzahl is null)
--> int_anzahl: amount of found beetles
--> lng_schaedling: type of beetle (1 or 2)
--> lng_falle:trap number
--> int_fallennummer: sub-trap type (1 or 2)
Background info: Data is entered once or twice a week for each trap. After the data has been entered I need to calculate the mean average depending on the volume or amount.
Therefore I need to sum the colume or amount and divide it by the period of days since the current and last trap removal (that's when the bugs are counted and data is manually entered to the DB). For each day between the last and current trap removal I need to add one record in table fangzahlen_tageswerte (in my proc still called "test" for obvious reasons) that contains the mean average value of found beetles.
I hope I could point out my demand without confusing you!
PS: my problem --> very little background info concerning the entomological monitoring of this beetle type ;-), limited pl/sql skills and the problem that I need to run this procedure for each new record only. If you could show me how to make sure that data is not stored in table fangzahlen_tageswerte multiple times, I could called it directly in APEX.
Otherwise I'd suggest to create a trigger that launches this procedure below and parses the :new.parameters into my pocedure.
Another problem: this might work for insert statements. However, obviously I have to correct the mean values if raw data in table fangzahlen has been updated. Should I call another procedure after update on tbl fangzahlen or integrate that part into the procedure below? Doesn't matter I guess, right?
create or replace
PROCEDURE "PR_FANGZAHLEN_TW_SK" (
pr_falle NUMBER,
pr_fallennummer NUMBER,
pr_schaedling NUMBER
IS
old_date DATE;
diff_days NUMBER (10);
tagesfang NUMBER (12);
y NUMBER (10);
BEGIN
/*Query date of previous record and store it into variable old_date*/
select date_datum into old_date from
(select f.date_datum, row_number() over (order by f.date_datum desc) rn
from borki.fangzahlen f where f.lng_falle = pr_falle
and f.int_fallennummer = pr_fallennummer
and f.lng_schaedling = pr_schaedling) where rn=2;
select max(f.date_datum) - old_date into diff_days from borki.fangzahlen f
where (f.lng_falle = pr_falle)
and (f.int_fallennummer = pr_fallennummer)
and (f.lng_schaedling = pr_schaedling);
FOR rec IN (select sum((case
when f.int_volumen > 0 and f.lng_schaedling = 1
then f.int_volumen * 40
when f.int_volumen > 0 and f.lng_schaedling = 2
then f.int_volumen * 550
when f.int_anzahl > 0
then f.int_anzahl
end
/ (f.date_datum - to_date(old_date))) as tagesfang
from borki.fangzahlen f
where (f.lng_falle = pr_falle)
and (f.int_fallennummer = pr_fallennummer)
and (f.lng_schaedling = pr_schaedling)
and ((f.date_datum - to_date(old_date)) > 0)
and ((f.int_anzahl > 0) or (f.int_volumen > 0)))
LOOP
y := 1;
WHILE y < diff_days + 1
LOOP
/* Insert FANGZAHLEN_TAGESWERTE*/
IF y < diff_days
THEN
INSERT INTO test
(lng_falle, date_datum, int_fallennummer,
lng_schaedling, int_volumen, int_anzahl,
lng_fangzahlen)
SELECT f.lng_falle,
old_date + y, f.int_fallennummer,
f.lng_schaedling, f.int_volumen, rec.tagesfang,
f.objectid
FROM fangzahlen f
WHERE f.lng_falle = pr_falle
AND f.int_fallennummer = pr_fallennummer
AND f.lng_schaedling = pr_schaedling
AND (f.date_datum - old_date) > 0
AND ( (f.int_anzahl > 0)
OR (f.int_volumen > 0) );
END IF;
y := y + 1;
END LOOP;
END LOOP; -- end of cursor
EXCEPTION
WHEN NO_DATA_FOUND
THEN
NULL;
WHEN OTHERS
THEN
-- Consider logging the error and then re-raise
RAISE;
END "PR_FANGZAHLEN_TW_SK";regards,
Seb -
How to find the max data transfer rate(disk speed) supported by mobo?
I plan on replacing my current HDD with a new and bigger HDD.
For this I need to know the max data transfer rate(disk speed) that my mobo will support. However, dmidecode is not telling me that. Am I missing something?
Here's dmidecode:
# dmidecode 2.11
SMBIOS 2.5 present.
80 structures occupying 2858 bytes.
Table at 0x000F0450.
Handle 0xDA00, DMI type 218, 101 bytes
OEM-specific Type
Header and Data:
DA 65 00 DA B2 00 17 4B 0E 38 00 00 80 00 80 01
00 02 80 02 80 01 00 00 A0 00 A0 01 00 58 00 58
00 01 00 59 00 59 00 01 00 75 01 75 01 01 00 76
01 76 01 01 00 05 80 05 80 01 00 D1 01 19 00 01
00 15 02 19 00 02 00 1B 00 19 00 03 00 19 00 19
00 00 00 4A 02 4A 02 01 00 0C 80 0C 80 01 00 FF
FF 00 00 00 00
Handle 0xDA01, DMI type 218, 35 bytes
OEM-specific Type
Header and Data:
DA 23 01 DA B2 00 17 4B 0E 38 00 10 F5 10 F5 00
00 11 F5 11 F5 00 00 12 F5 12 F5 00 00 FF FF 00
00 00 00
Handle 0x0000, DMI type 0, 24 bytes
BIOS Information
Vendor: Dell Inc.
Version: A17
Release Date: 04/06/2010
Address: 0xF0000
Runtime Size: 64 kB
ROM Size: 4096 kB
Characteristics:
PCI is supported
PNP is supported
APM is supported
BIOS is upgradeable
BIOS shadowing is allowed
ESCD support is available
Boot from CD is supported
Selectable boot is supported
EDD is supported
Japanese floppy for Toshiba 1.2 MB is supported (int 13h)
3.5"/720 kB floppy services are supported (int 13h)
Print screen service is supported (int 5h)
8042 keyboard services are supported (int 9h)
Serial services are supported (int 14h)
Printer services are supported (int 17h)
ACPI is supported
USB legacy is supported
BIOS boot specification is supported
Function key-initiated network boot is supported
Targeted content distribution is supported
BIOS Revision: 17.0
Handle 0x0100, DMI type 1, 27 bytes
System Information
Manufacturer: Dell Inc.
Product Name: OptiPlex 755
Version: Not Specified
UUID: 44454C4C-5900-1050-8033-C4C04F434731
Wake-up Type: Power Switch
SKU Number: Not Specified
Family: Not Specified
Handle 0x0200, DMI type 2, 8 bytes
Base Board Information
Manufacturer: Dell Inc.
Product Name: 0PU052
Version:
Handle 0x0300, DMI type 3, 13 bytes
Chassis Information
Manufacturer: Dell Inc.
Type: Space-saving
Lock: Not Present
Version: Not Specified
Asset Tag:
Boot-up State: Safe
Power Supply State: Safe
Thermal State: Safe
Security Status: None
Handle 0x0400, DMI type 4, 40 bytes
Processor Information
Socket Designation: CPU
Type: Central Processor
Family: Xeon
Manufacturer: Intel
ID: 76 06 01 00 FF FB EB BF
Signature: Type 0, Family 6, Model 23, Stepping 6
Flags:
FPU (Floating-point unit on-chip)
VME (Virtual mode extension)
DE (Debugging extension)
PSE (Page size extension)
TSC (Time stamp counter)
MSR (Model specific registers)
PAE (Physical address extension)
MCE (Machine check exception)
CX8 (CMPXCHG8 instruction supported)
APIC (On-chip APIC hardware supported)
SEP (Fast system call)
MTRR (Memory type range registers)
PGE (Page global enable)
MCA (Machine check architecture)
CMOV (Conditional move instruction supported)
PAT (Page attribute table)
PSE-36 (36-bit page size extension)
CLFSH (CLFLUSH instruction supported)
DS (Debug store)
ACPI (ACPI supported)
MMX (MMX technology supported)
FXSR (FXSAVE and FXSTOR instructions supported)
SSE (Streaming SIMD extensions)
SSE2 (Streaming SIMD extensions 2)
SS (Self-snoop)
HTT (Multi-threading)
TM (Thermal monitor supported)
PBE (Pending break enabled)
Version: Not Specified
Voltage: 0.0 V
External Clock: 1333 MHz
Max Speed: 5200 MHz
Current Speed: 2666 MHz
Status: Populated, Enabled
Upgrade: Socket LGA775
L1 Cache Handle: 0x0700
L2 Cache Handle: 0x0701
L3 Cache Handle: Not Provided
Serial Number: Not Specified
Asset Tag: Not Specified
Part Number: Not Specified
Core Count: 2
Core Enabled: 2
Thread Count: 2
Characteristics:
64-bit capable
Handle 0x0700, DMI type 7, 19 bytes
Cache Information
Socket Designation: Not Specified
Configuration: Enabled, Not Socketed, Level 1
Operational Mode: Write Back
Location: Internal
Installed Size: 32 kB
Maximum Size: 32 kB
Supported SRAM Types:
Other
Installed SRAM Type: Other
Speed: Unknown
Error Correction Type: None
System Type: Data
Associativity: 8-way Set-associative
Handle 0x0701, DMI type 7, 19 bytes
Cache Information
Socket Designation: Not Specified
Configuration: Enabled, Not Socketed, Level 2
Operational Mode: Varies With Memory Address
Location: Internal
Installed Size: 6144 kB
Maximum Size: 6144 kB
Supported SRAM Types:
Other
Installed SRAM Type: Other
Speed: Unknown
Error Correction Type: Single-bit ECC
System Type: Unified
Associativity: <OUT OF SPEC>
Handle 0x0800, DMI type 8, 9 bytes
Port Connector Information
Internal Reference Designator: PARALLEL
Internal Connector Type: None
External Reference Designator: Not Specified
External Connector Type: DB-25 female
Port Type: Parallel Port PS/2
Handle 0x0801, DMI type 8, 9 bytes
Port Connector Information
Internal Reference Designator: SERIAL1
Internal Connector Type: None
External Reference Designator: Not Specified
External Connector Type: DB-9 male
Port Type: Serial Port 16550A Compatible
Handle 0x0802, DMI type 126, 9 bytes
Inactive
Handle 0x0803, DMI type 126, 9 bytes
Inactive
Handle 0x0804, DMI type 126, 9 bytes
Inactive
Handle 0x0805, DMI type 8, 9 bytes
Port Connector Information
Internal Reference Designator: USB1
Internal Connector Type: None
External Reference Designator: Not Specified
External Connector Type: Access Bus (USB)
Port Type: USB
Handle 0x0806, DMI type 8, 9 bytes
Port Connector Information
Internal Reference Designator: USB2
Internal Connector Type: None
External Reference Designator: Not Specified
External Connector Type: Access Bus (USB)
Port Type: USB
Handle 0x0807, DMI type 8, 9 bytes
Port Connector Information
Internal Reference Designator: USB3
Internal Connector Type: None
External Reference Designator: Not Specified
External Connector Type: Access Bus (USB)
Port Type: USB
Handle 0x0808, DMI type 8, 9 bytes
Port Connector Information
Internal Reference Designator: USB4
Internal Connector Type: None
External Reference Designator: Not Specified
External Connector Type: Access Bus (USB)
Port Type: USB
Handle 0x0809, DMI type 8, 9 bytes
Port Connector Information
Internal Reference Designator: USB5
Internal Connector Type: None
External Reference Designator: Not Specified
External Connector Type: Access Bus (USB)
Port Type: USB
Handle 0x080A, DMI type 8, 9 bytes
Port Connector Information
Internal Reference Designator: USB6
Internal Connector Type: None
External Reference Designator: Not Specified
External Connector Type: Access Bus (USB)
Port Type: USB
Handle 0x080B, DMI type 8, 9 bytes
Port Connector Information
Internal Reference Designator: USB7
Internal Connector Type: None
External Reference Designator: Not Specified
External Connector Type: Access Bus (USB)
Port Type: USB
Handle 0x080C, DMI type 8, 9 bytes
Port Connector Information
Internal Reference Designator: USB8
Internal Connector Type: None
External Reference Designator: Not Specified
External Connector Type: Access Bus (USB)
Port Type: USB
Handle 0x080D, DMI type 8, 9 bytes
Port Connector Information
Internal Reference Designator: ENET
Internal Connector Type: None
External Reference Designator: Not Specified
External Connector Type: RJ-45
Port Type: Network Port
Handle 0x080E, DMI type 8, 9 bytes
Port Connector Information
Internal Reference Designator: MIC
Internal Connector Type: None
External Reference Designator: Not Specified
External Connector Type: Mini Jack (headphones)
Port Type: Audio Port
Handle 0x080F, DMI type 8, 9 bytes
Port Connector Information
Internal Reference Designator: LINE-OUT
Internal Connector Type: None
External Reference Designator: Not Specified
External Connector Type: Mini Jack (headphones)
Port Type: Audio Port
Handle 0x0810, DMI type 8, 9 bytes
Port Connector Information
Internal Reference Designator: LINE-IN
Internal Connector Type: None
External Reference Designator: Not Specified
External Connector Type: Mini Jack (headphones)
Port Type: Audio Port
Handle 0x0811, DMI type 8, 9 bytes
Port Connector Information
Internal Reference Designator: HP-OUT
Internal Connector Type: None
External Reference Designator: Not Specified
External Connector Type: Mini Jack (headphones)
Port Type: Audio Port
Handle 0x0812, DMI type 8, 9 bytes
Port Connector Information
Internal Reference Designator: MONITOR
Internal Connector Type: None
External Reference Designator: Not Specified
External Connector Type: DB-15 female
Port Type: Video Port
Handle 0x090A, DMI type 9, 13 bytes
System Slot Information
Designation: SLOT1
Type: x1 Proprietary
Current Usage: In Use
Length: Long
Characteristics:
PME signal is supported
Handle 0x0901, DMI type 126, 13 bytes
Inactive
Handle 0x0902, DMI type 9, 13 bytes
System Slot Information
Designation: SLOT2
Type: 32-bit PCI
Current Usage: Available
Length: Long
ID: 2
Characteristics:
5.0 V is provided
3.3 V is provided
PME signal is supported
Handle 0x0903, DMI type 126, 13 bytes
Inactive
Handle 0x0904, DMI type 126, 13 bytes
Inactive
Handle 0x0905, DMI type 126, 13 bytes
Inactive
Handle 0x0906, DMI type 126, 13 bytes
Inactive
Handle 0x0907, DMI type 126, 13 bytes
Inactive
Handle 0x0908, DMI type 126, 13 bytes
Inactive
Handle 0x0A00, DMI type 10, 6 bytes
On Board Device Information
Type: Video
Status: Disabled
Description: Intel Graphics Media Accelerator 950
Handle 0x0A02, DMI type 10, 6 bytes
On Board Device Information
Type: Ethernet
Status: Enabled
Description: Intel Gigabit Ethernet Controller
Handle 0x0A03, DMI type 10, 6 bytes
On Board Device Information
Type: Sound
Status: Enabled
Description: Intel(R) High Definition Audio Controller
Handle 0x0B00, DMI type 11, 5 bytes
OEM Strings
String 1: www.dell.com
Handle 0x0D00, DMI type 13, 22 bytes
BIOS Language Information
Language Description Format: Long
Installable Languages: 1
en|US|iso8859-1
Currently Installed Language: en|US|iso8859-1
Handle 0x0F00, DMI type 15, 29 bytes
System Event Log
Area Length: 2049 bytes
Header Start Offset: 0x0000
Header Length: 16 bytes
Data Start Offset: 0x0010
Access Method: Memory-mapped physical 32-bit address
Access Address: 0xFFF01000
Status: Valid, Not Full
Change Token: 0x00000018
Header Format: Type 1
Supported Log Type Descriptors: 3
Descriptor 1: POST error
Data Format 1: POST results bitmap
Descriptor 2: System limit exceeded
Data Format 2: System management
Descriptor 3: Log area reset/cleared
Data Format 3: None
Handle 0x1000, DMI type 16, 15 bytes
Physical Memory Array
Location: System Board Or Motherboard
Use: System Memory
Error Correction Type: None
Maximum Capacity: 8 GB
Error Information Handle: Not Provided
Number Of Devices: 4
Handle 0x1100, DMI type 17, 27 bytes
Memory Device
Array Handle: 0x1000
Error Information Handle: Not Provided
Total Width: 64 bits
Data Width: 64 bits
Size: 1024 MB
Form Factor: DIMM
Set: None
Locator: DIMM_1
Bank Locator: Not Specified
Type: DDR2
Type Detail: Synchronous
Speed: 667 MHz
Manufacturer: AD00000000000000
Handle 0x1101, DMI type 17, 27 bytes
Memory Device
Array Handle: 0x1000
Error Information Handle: Not Provided
Total Width: 64 bits
Data Width: 64 bits
Size: 1024 MB
Form Factor: DIMM
Set: None
Locator: DIMM_3
Bank Locator: Not Specified
Type: DDR2
Type Detail: Synchronous
Speed: 667 MHz
Handle 0x1102, DMI type 17, 27 bytes
Memory Device
Array Handle: 0x1000
Error Information Handle: Not Provided
Total Width: 64 bits
Data Width: 64 bits
Size: 1024 MB
Form Factor: DIMM
Set: None
Locator: DIMM_2
Bank Locator: Not Specified
Type: DDR2
Type Detail: Synchronous
Speed: 667 MHz
Handle 0x1103, DMI type 17, 27 bytes
Memory Device
Array Handle: 0x1000
Error Information Handle: Not Provided
Total Width: 64 bits
Data Width: 64 bits
Size: 1024 MB
Form Factor: DIMM
Set: None
Locator: DIMM_4
Bank Locator: Not Specified
Type: DDR2
Type Detail: Synchronous
Speed: 667 MHz
Handle 0x1300, DMI type 19, 15 bytes
Memory Array Mapped Address
Starting Address: 0x00000000000
Ending Address: 0x000FDFFFFFF
Range Size: 4064 MB
Physical Array Handle: 0x1000
Partition Width: 1
Handle 0x1400, DMI type 20, 19 bytes
Memory Device Mapped Address
Starting Address: 0x00000000000
Ending Address: 0x0007FFFFFFF
Range Size: 2 GB
Physical Device Handle: 0x1100
Memory Array Mapped Address Handle: 0x1300
Partition Row Position: 1
Interleave Position: 1
Interleaved Data Depth: 1
Handle 0x1401, DMI type 20, 19 bytes
Memory Device Mapped Address
Starting Address: 0x00080000000
Ending Address: 0x000FDFFFFFF
Range Size: 2016 MB
Physical Device Handle: 0x1101
Memory Array Mapped Address Handle: 0x1300
Partition Row Position: 1
Interleave Position: 1
Interleaved Data Depth: 1
Handle 0x1402, DMI type 20, 19 bytes
Memory Device Mapped Address
Starting Address: 0x00000000000
Ending Address: 0x0007FFFFFFF
Range Size: 2 GB
Physical Device Handle: 0x1102
Memory Array Mapped Address Handle: 0x1300
Partition Row Position: 1
Interleave Position: 2
Interleaved Data Depth: 1
Handle 0x1403, DMI type 20, 19 bytes
Memory Device Mapped Address
Starting Address: 0x00080000000
Ending Address: 0x000FDFFFFFF
Range Size: 2016 MB
Physical Device Handle: 0x1103
Memory Array Mapped Address Handle: 0x1300
Partition Row Position: 1
Interleave Position: 2
Interleaved Data Depth: 1
Handle 0x1410, DMI type 126, 19 bytes
Inactive
Handle 0x1800, DMI type 24, 5 bytes
Hardware Security
Power-On Password Status: Enabled
Keyboard Password Status: Not Implemented
Administrator Password Status: Enabled
Front Panel Reset Status: Not Implemented
Handle 0x1900, DMI type 25, 9 bytes
System Power Controls
Next Scheduled Power-on: *-* 00:00:00
Handle 0x1B10, DMI type 27, 12 bytes
Cooling Device
Type: Fan
Status: OK
OEM-specific Information: 0x0000DD00
Handle 0x1B11, DMI type 27, 12 bytes
Cooling Device
Type: Fan
Status: OK
OEM-specific Information: 0x0000DD01
Handle 0x1B12, DMI type 126, 12 bytes
Inactive
Handle 0x1B13, DMI type 126, 12 bytes
Inactive
Handle 0x1B14, DMI type 126, 12 bytes
Inactive
Handle 0x2000, DMI type 32, 11 bytes
System Boot Information
Status: No errors detected
Handle 0x8100, DMI type 129, 8 bytes
OEM-specific Type
Header and Data:
81 08 00 81 01 01 02 01
Strings:
Intel_ASF
Intel_ASF_001
Handle 0x8200, DMI type 130, 20 bytes
OEM-specific Type
Header and Data:
82 14 00 82 24 41 4D 54 01 01 00 00 01 A5 0B 02
00 00 00 00
Handle 0x8300, DMI type 131, 64 bytes
OEM-specific Type
Header and Data:
83 40 00 83 14 00 00 00 00 00 C0 29 05 00 00 00
F8 00 4E 24 00 00 00 00 0D 00 00 00 02 00 03 00
19 04 14 00 01 00 01 02 C8 00 BD 10 00 00 00 00
00 00 00 00 FF 00 00 00 00 00 00 00 00 00 00 00
Handle 0x8800, DMI type 136, 6 bytes
OEM-specific Type
Header and Data:
88 06 00 88 5A 5A
Handle 0xD000, DMI type 208, 10 bytes
OEM-specific Type
Header and Data:
D0 0A 00 D0 01 03 FE 00 11 02
Handle 0xD100, DMI type 209, 12 bytes
OEM-specific Type
Header and Data:
D1 0C 00 D1 78 03 07 03 04 0F 80 05
Handle 0xD200, DMI type 210, 12 bytes
OEM-specific Type
Header and Data:
D2 0C 00 D2 F8 03 04 03 06 80 04 05
Handle 0xD201, DMI type 126, 12 bytes
Inactive
Handle 0xD400, DMI type 212, 242 bytes
OEM-specific Type
Header and Data:
D4 F2 00 D4 70 00 71 00 00 10 2D 2E 42 00 11 FE
01 43 00 11 FE 00 0F 00 25 FC 00 10 00 25 FC 01
11 00 25 FC 02 12 00 25 FC 03 00 00 25 F3 00 00
00 25 F3 04 00 00 25 F3 08 00 00 25 F3 0C 07 00
23 8F 00 08 00 23 F3 00 09 00 23 F3 04 0A 00 23
F3 08 0B 00 23 8F 10 0C 00 23 8F 20 0E 00 23 8F
30 0D 00 23 8C 40 A6 00 23 8C 41 A7 00 23 8C 42
05 01 22 FD 02 06 01 22 FD 00 8C 00 22 FE 00 8D
00 22 FE 01 9B 00 25 3F 40 9C 00 25 3F 00 09 01
25 3F 80 A1 00 26 F3 00 A2 00 26 F3 08 A3 00 26
F3 04 9F 00 26 FD 02 A0 00 26 FD 00 9D 00 11 FB
04 9E 00 11 FB 00 54 01 23 7F 00 55 01 23 7F 80
5C 00 78 BF 40 5D 00 78 BF 00 04 80 78 F5 0A 01
A0 78 F5 00 93 00 7B 7F 80 94 00 7B 7F 00 8A 00
37 DF 20 8B 00 37 DF 00 03 C0 67 00 05 FF FF 00
00 00
Handle 0xD401, DMI type 212, 172 bytes
OEM-specific Type
Header and Data:
D4 AC 01 D4 70 00 71 00 03 40 59 6D 2D 00 59 FC
02 2E 00 59 FC 00 6E 00 59 FC 01 E0 01 59 FC 03
28 00 59 3F 00 29 00 59 3F 40 2A 00 59 3F 80 2B
00 5A 00 00 2C 00 5B 00 00 55 00 59 F3 00 6D 00
59 F3 04 8E 00 59 F3 08 8F 00 59 F3 00 00 00 55
FB 04 00 00 55 FB 00 23 00 55 7F 00 22 00 55 7F
80 F5 00 58 BF 40 F6 00 58 BF 00 EB 00 55 FE 00
EA 00 55 FE 01 40 01 54 EF 00 41 01 54 EF 10 ED
00 54 F7 00 F0 00 54 F7 08 4A 01 53 DF 00 4B 01
53 DF 20 4C 01 53 7F 00 4D 01 53 7F 80 68 01 56
BF 00 69 01 56 BF 40 FF FF 00 00 00
Handle 0xD402, DMI type 212, 152 bytes
OEM-specific Type
Header and Data:
D4 98 02 D4 70 00 71 00 00 10 2D 2E 2D 01 21 FE
01 2E 01 21 FE 00 97 00 22 FB 00 98 00 22 FB 04
90 00 11 CF 00 91 00 11 CF 20 92 00 11 CF 10 E2
00 27 7F 00 E3 00 27 7F 80 E4 00 27 BF 00 E5 00
27 BF 40 D1 00 22 7F 80 D2 00 22 7F 00 45 01 22
BF 40 44 01 22 BF 00 36 01 21 F1 06 37 01 21 F1
02 38 01 21 F1 00 39 01 21 F1 04 2B 01 11 7F 80
2C 01 11 7F 00 4E 01 65 CF 00 4F 01 65 CF 10 D4
01 65 F3 00 D5 01 65 F3 04 D2 01 65 FC 00 D3 01
65 FC 01 FF FF 00 00 00
Handle 0xD403, DMI type 212, 157 bytes
OEM-specific Type
Header and Data:
D4 9D 03 D4 70 00 71 00 03 40 59 6D 17 01 52 FE
00 18 01 52 FE 01 19 01 52 FB 00 1A 01 52 FB 04
1B 01 52 FD 00 1C 01 52 FD 02 1D 01 52 F7 00 1E
01 52 F7 08 1F 01 52 EF 00 20 01 52 EF 10 21 01
52 BF 00 22 01 52 BF 40 87 00 59 DF 20 88 00 59
DF 00 E8 01 66 FD 00 E9 01 66 FD 02 02 02 53 BF
00 03 02 53 BF 40 04 02 53 EF 00 05 02 53 EF 10
06 02 66 DF 00 07 02 66 DF 20 08 02 66 EF 00 09
02 66 EF 10 17 02 66 F7 00 18 02 66 F7 08 44 02
52 BF 40 45 02 52 BF 00 FF FF 00 00 00
Handle 0xD800, DMI type 126, 9 bytes
Inactive
Handle 0xDD00, DMI type 221, 19 bytes
OEM-specific Type
Header and Data:
DD 13 00 DD 00 01 00 00 00 10 F5 00 00 00 00 00
00 00 00
Handle 0xDD01, DMI type 221, 19 bytes
OEM-specific Type
Header and Data:
DD 13 01 DD 00 01 00 00 00 11 F5 00 00 00 00 00
00 00 00
Handle 0xDD02, DMI type 221, 19 bytes
OEM-specific Type
Header and Data:
DD 13 02 DD 00 01 00 00 00 12 F5 00 00 00 00 00
00 00 00
Handle 0xDE00, DMI type 222, 16 bytes
OEM-specific Type
Header and Data:
DE 10 00 DE C1 0B 00 00 10 05 19 21 01 00 00 01
Handle 0x7F00, DMI type 127, 4 bytes
End Of Table
Hdparm also does not tell me the max data transfer rate (disk speed) of my current drive although this link : www.wdc.com/en/library/sata/2879-001146.pdf says that it is 3.0Gb/s
and here's hdparm -I /dev/sda
/dev/sda:
ATA device, with non-removable media
Model Number: WDC WD800JD-75JNC0
Firmware Revision: 06.01C06
Standards:
Supported: 6 5 4
Likely used: 8
Configuration:
Logical max current
cylinders 16383 16383
heads 16 16
sectors/track 63 63
CHS current addressable sectors: 16514064
LBA user addressable sectors: 156250000
Logical/Physical Sector size: 512 bytes
device size with M = 1024*1024: 76293 MBytes
device size with M = 1000*1000: 80000 MBytes (80 GB)
cache/buffer size = 8192 KBytes
Capabilities:
LBA, IORDY(can be disabled)
Standby timer values: spec'd by Standard, with device specific minimum
R/W multiple sector transfer: Max = 16 Current = 8
Recommended acoustic management value: 128, current value: 254
DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 *udma5
Cycle time: min=120ns recommended=120ns
PIO: pio0 pio1 pio2 pio3 pio4
Cycle time: no flow control=120ns IORDY flow control=120ns
Commands/features:
Enabled Supported:
* SMART feature set
Security Mode feature set
* Power Management feature set
* Write cache
* Look-ahead
* Host Protected Area feature set
* WRITE_BUFFER command
* READ_BUFFER command
* DOWNLOAD_MICROCODE
SET_MAX security extension
Automatic Acoustic Management feature set
* Device Configuration Overlay feature set
* Mandatory FLUSH_CACHE
* SMART error logging
* SMART self-test
* Gen1 signaling speed (1.5Gb/s)
* Host-initiated interface power management
* SMART Command Transport (SCT) feature set
* SCT Long Sector Access (AC1)
* SCT LBA Segment Access (AC2)
* SCT Error Recovery Control (AC3)
* SCT Features Control (AC4)
* SCT Data Tables (AC5)
Security:
Master password revision code = 65534
supported
not enabled
not locked
frozen
not expired: security count
not supported: enhanced erase
Checksum: correct
Last edited by Inxsible (2011-03-27 04:40:49)I just checked my BIOS and my current setting is set at IDE although it also mentions that the default should be AHCI. Currently I have a dual boot of Windows 7 (need it for Tax software) and Arch
So I guess, when I get the new HDD, I will first set it to AHCI and then install the OSes on it. See if NCQ helps any, and if not I will turn it back and re-install (if I have to). I am planning to have Windows only in virtualbox in the new drive.
Anyhoo, while I was in the BIOS I found two things which I had questions about :
1) Under Onboard Devices --> Integrated NIC , my setting is currently set at "On w/PXE" and it says the default should be just "On". Would it be ok to change it back to On since its a single machine and its not booting an OS on any server. I just don't want to have to re-install anything now since I will be doing that in the new HDD.
2) How would I know whether my BIOS would support a 64 bit OS in Virtualbox? I checked some setting under Virtualization, but they weren't very clear.
I will edit this post and let you know exactly what settings were present under the Virtualization sub-section.
Maybe you are looking for
-
Incessant fan operation since 10.5.6 update
Since applying the 10.5.6 update to my PowerBook G4, the cooling fan runs non-stop, sometimes at seemingly top speed. Tried PRAM reset, no change. Ideas, please anyone. Thanks.
-
Built-in iSight vs External iSight
Hello. I have a late 2008 MacBook Pro with the built-in iSight camera. But also recently found an external iSight camera at an auction website that I might want to buy. How do the quality of the cameras compare? Also with two cameras attached, am I a
-
When I run a single webi report, the repsonse is normal, i.e., around 10s. However, when there are 5 users concurrent executing the same report, with same input criteria, the performance degrades significantly, i.e., around 30s - 40s to retrieve the
-
How can i manually uninstall and keep all my music?
Regular uninstall doesnt work, it gets and error. How do i maually uninstall and still keep my music/playlists and everything like that in tack? Thanks for any help you can offer!! ~Sean
-
Create a new writable folder and change permissions
This is for a customer job; I fix PCs and MACs (mostly PCs) for a living. (1) How do I create a new writable folder on a BRAND new external HD under OS X (assume 10.5 or 10.6). Note I will first reformat the external usb HD to Apple OS extended using