Returning one row in a view(only)
Is there any function that I can use to return just one row from a query?
I tryed the old LIMIT TO from rdb, but its useless...
I´m using a Oracle8
Try using "where ROWNUM = 1" for the first row returned by the select
Similar Messages
-
Way to rollback only one row of a view object
Is there a way to "rollback" only one row of a view object? That is, two or more rows have been modified but we wish to only restore one of the rows to the original (database) values.
Is there a way to retain all of the current rows in all of the view objects for an application module after issuing a jbo:Rollback?
ThanksIs there a way to "rollback" only one row of a view object? That is, two or more rows have been modified but we wish to only restore one of the rows to the original (database) values.In jdev903, a new method is being added to Row interface to reset the row state to the transaction-original state i.e., rollback the row to it's original values.
Is there a way to retain all of the current rows in all of the view objects for an application module after issuing a jbo:Rollback?No. You may however override before/afterRollback methods on the ViewObjectImpl subclasses to cache the current row key in beforeRollback and restore currency on the default iterator to that rowkey in afterRollback
Thanks -
How just return one row of a one to many join..
So I have a one to many join where the SMOPERATOR table has data I need however it has a couple of rows that match the JOIN condition in there. I just need to return one row. I think this can be accomplished with a subquery in the join however have not been able to come up with the right syntax to do so.
So:
SELECT "NUMBER" as danumber,
NAME,
SMINCREQ.ASSIGNMENT,
SMOPERATOR.PRIMARY_ASSIGNMENT_GROUP,
SMOPERATOR.WDMANAGERNAME,
SMINCREQ.owner_manager_name,
SMINCREQ.subcategory, TO_DATE('01-'||TO_CHAR(open_time,'MM-YYYY'),'DD-MM-YYYY')MONTHSORT,
(CASE WHEN bc_request='f' THEN 'IAIO'
WHEN (bc_request='t' and substr(assignment,1,3)<>'MTS') THEN 'RARO'
WHEN (bc_request='t' and substr(assignment,1,3)='MTS') THEN 'M'
ELSE 'U' end) as type
from SMINCREQ
left outer join SMOPERATOR on SMINCREQ.assignment=SMOPERATOR.primary_assignment_group
WHERE SMINCREQ.owner_manager_name=:P170_SELECTION and SMOPERATOR.wdmanagername=:P170_SELECTION
AND open_time BETWEEN to_date(:P170_SDATEB,'DD-MON-YYYY') AND to_date(:P170_EDATEB,'DD-MON-YYYY')
AND
(bc_request='f' and subcategory='ACTIVATION' and related_record<>'t')
OR
(bc_request='f' and subcategory<>'ACTIVATION')
OR
(bc_request='t' and substr(assignment,1,3)<>'MTS')
order by OPEN_TIMeHi,
This sounds like a Top-N Query , where you pick N items (N=1 in this case) off the top of an orderded list. I think you want a separate ordered list for each assignment; the analytic ROW_NUMBER function does that easily.
Since you didn't post CREATE TABLE and INSERT statements for your sample data, I'll use tables from the scott schema to show how this is done.
Say you have a query like this:
SELECT d.dname
, e.empno, e.ename, e.job, e.sal
FROM scott.dept d
JOIN scott.emp e ON d.deptno = e.deptno
ORDER BY dname
;which produces this output:
DNAME EMPNO ENAME JOB SAL
ACCOUNTING 7934 MILLER CLERK 1300
ACCOUNTING 7839 KING PRESIDENT 5000
ACCOUNTING 7782 CLARK MANAGER 2450
RESEARCH 7876 ADAMS CLERK 1100
RESEARCH 7902 FORD ANALYST 3000
RESEARCH 7566 JONES MANAGER 2975
RESEARCH 7369 SMITH CLERK 800
RESEARCH 7788 SCOTT ANALYST 3000
SALES 7521 WARD SALESMAN 1250
SALES 7844 TURNER SALESMAN 1500
SALES 7499 ALLEN SALESMAN 1600
SALES 7900 JAMES CLERK 950
SALES 7698 BLAKE MANAGER 2850
SALES 7654 MARTIN SALESMAN 1250Now say you want to change the query so that it only returns one row per department, like this:
DNAME EMPNO ENAME JOB SAL
ACCOUNTING 7782 CLARK MANAGER 2450
RESEARCH 7876 ADAMS CLERK 1100
SALES 7499 ALLEN SALESMAN 1600where the empno, ename, job and sal columns on each row of output are all taken from the same row of scott.emp, though it doesn't really matter which row that is.
One way to do it is to use the analytic ROW_NUMBER function to assign a sequence of unique numbers (1, 2, 3, ...) to all the rows in each department. Since each sequence startw with 1, and the numbers are unique within a department, there will be exactly one row per departement that was assigned the numebr 1, and we''ll display that row.
Here's how to code that:
WITH got_r_num AS
SELECT d.dname
, e.empno, e.ename, e.job, e.sal
, ROW_NUMBER () OVER ( PARTITION BY d.dname
ORDER BY e.ename
) AS r_num
FROM scott.dept d
JOIN scott.emp e ON d.deptno = e.deptno
SELECT dname
, empno, ename, job, sal
FROM got_r_num
WHERE r_num = 1
ORDER BY dname
;Notice that he sub-query got_r_num is almost the same as the original query; only it has one additional column, r_num, in the SELECT clause, and the sub-qeury does not have an ORDER BY clause. (Sub-queries almost never have an ORDER BY clause.)
The ROW_NUMBER function must have an ORDER BY clause. In this example, I used "ORDER BY ename", meaning that, within each department, the row with the first ename (in sort order) will get r_num=1. You can use any column, or expression, or expressions in the ORDER BY clause. You muight as well use something consistent and predictable, like ename, but if you really wanted arbitrary numbering you could use a constant in the analytic ORDER BY clause, e.g. "ORDER BY NULL". -
Result Set only returning one row...
When I run the following query in my program, I only get one row.
SELECT * FROM (SELECT * FROM ul_common_log_event WHERE application_name = 'Configuration' ORDER BY cle_id DESC) WHERE ROWNUM <= 500;
However when I run it in TOAD, I get all the rows I am looking for.
Here's my java
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(query);
My record set only contain one row. I am using Oracle 9 OCI driver BTW.
Any ideas? Thanks!Good thinking. That was the first thing I tried. That was not the problem. It turns out that I was stomping my rs object in another method. Problem resolved!
Thanks for the reply! -
How to return one ROW with Multiple value seperated by Colon in a SQL Query
Hi,
I have a SQL query as mentioned.
select deptno
from deptI want to mofidfy this query, so that this should return me department list with colon delimeted in one ROW.
10:20:30:40.......Thanks,
DeepakIn 10g:
select rtrim(xmlagg(xmlparse(content deptno || ':')).getstringval(), ':') data
from dept;
DATA
10:20:30:40with apologies for the abuse of XML... -
I apologize if this is a duplicate of some other post, but I'm not finding this exact scenario.
Assume that I have a table that looks like this:
select * from PROD_TABLE
PROD DESCRIPTION
1234 CANDLES
1234 CANDLE
1235 BRAKE PADS
1235 BRAKE PAD
(Yes, I know, I know, but it's for a POC, so dirty data will be cleaned up later.)
What I'd like to do is create a select statement that returns two rows from this table, one row for Prod 1234, one row for Prod 1235, and I DON'T CARE which description is returned for the corresponding Prod. For the POC, it's just not important which one is returned.
How can I craft the select statement?try this
SQL> with t as (select 1234 prod, 'CANDLES' dec from dual union all
2 select 1234 ,'CANDLE' dec from dual union all
3 select 1235 ,'BRAKE PADS' dec from dual union all
4 select 1235 ,'BRAKE PAD' dec from dual)
5 SELECT prod, DEC
6 FROM ( SELECT a.*
7 , ROW_NUMBER ( ) OVER ( PARTITION BY prod ORDER BY prod ) rn
8 FROM t a )
9 WHERE rn = 1
10 /
PROD DEC
1234 CANDLES
1235 BRAKE PADS
SQL> -
This is part of SQL query in FROM clause:
select id, t, phase, time from measurement where phase=1 where id='1234'
This query can return more than one raw, but I need the only one, the latest one
I tried a lot of different stuff but no success!
ThanksGee, not sure if I got you right, but are you really sure that you need to do five (!) outer joins to your METNET table? Dont forget, each join, be it NESTED LOOPS, HASH or MERGE, requires extra CPU and I/O resources
Consider this query as a possible alternative:
SELECT tmh.heatid,
decode(tempcb.phase_id, 1, tempcb.t) cb,
decode(tempcb.phase_id, 2, tempcb.t) cb1,
decode(tempcb.phase_id, 3, tempcb.t) blow1,
decode(tempcb.phase_id, 4, tempcb.t) blow2,
decode(tempcb.phase_id, 5, tempcb.t) blow3
FROM heat_melt_proces_data hmpd,
tmelted_heats tmh,
(select t, sarza, phase_id
from metnet
where phase_id BETWEEN 1 AND 5) tempcb
WHERE hmpd.heatid=tmh.heatid
and tempcb.sarza (+) = tmh.heatid
and (to_char(hmpd.convertertappingendtime , 'YYYY-MM-DD HH24:MI') between '2006-06-10 22:30:01' and '2006-06-12 06:30:00')
order by tmh.heatid, hmpd.convertertappingendtime;And if I got you right regarding your TRANSFERTIME column, this is what you are looking for:
SELECT tmh.heatid,
decode(tempcb.phase_id, 1, tempcb.t) cb,
decode(tempcb.phase_id, 2, tempcb.t) cb1,
decode(tempcb.phase_id, 3, tempcb.t) blow1,
decode(tempcb.phase_id, 4, tempcb.t) blow2,
decode(tempcb.phase_id, 5, tempcb.t) blow3
FROM heat_melt_proces_data hmpd,
tmelted_heats tmh,
(select * from
(select t, sarza, phase_id,
row_number() over
(partition by sarza, phase_id order by transfertime desc) rn
from metnet
where phase_id BETWEEN 1 AND 5)
where rn = 1) tempcb
WHERE hmpd.heatid=tmh.heatid
and tempcb.sarza (+) = tmh.heatid
and (to_char(hmpd.convertertappingendtime , 'YYYY-MM-DD HH24:MI') between '2006-06-10 22:30:01' and '2006-06-12 06:30:00')
order by tmh.heatid, hmpd.convertertappingendtime;
Tip: converting DATEs into VARCHARs and using BETWEEN <varchar-const> AND <varchar-const> is generally an ouch-ouch approach. -
Return one row (DISTINCT) in a query BEX
Hi guru, i have this scenary:
one infoset on ods with timestamp field and material code
In the ODS i found many occurrence with same material code, but with many timestamp loading, es:
material timestamp
00AAA 20070301
00AAA 20070201
00BBB 20070101
in my query i want this result:
00AAA 20070301
00BBB 20070101
Can i have help for this troble ?
Thank's a lot.Hi,
I think is not possible to do this in the query. I think you have to filter the ODS data. I would build another DSO and would filter the data in the transformation. If you buid another DSO you can include the master data and you wouldn't need the infoset.
Regards -
When selecting a row from a view with a nested table I want just ONE entry returned
Does a nested table in a view "EXPLODE" all values ALWAYS no matter the where clause for the nested table?
I want to select ONE row from a view that has columns defined as TYPE which are PL/SQL TABLES OF other tables.
when I specify a WHERE clause for my query it gives me the column "EXPLODED" with the values that mathc my WHERE clause at the end of the select.
I dont want the "EXPLODED" nested table to show just the entry that matches my WHERE clause. Here is some more info:
My select statement:
SQL> select * from si_a31_per_vw v, TABLE(v.current_allergies) a where a.alg_seq
=75;
AAAHQPAAMAAAAfxAAA N00000 771 223774444 20 GREGG
CADILLAC 12-MAY-69 M R3
NON DENOMINATIONAL N STAFF USMC N
U
E06 11-JUN-02 H N
05-JAN-00 Y Y
USS SPAWAR
353535 USS SPAWAR
SI_ADDRESS_TYPE(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NUL
L, NULL)
SI_ADDRESS_TAB()
SI_ALLERGY_TAB(SI_ALLERGY_TYPE(69, 'PENICILLIN', '11-JUN-02', NULL), SI_ALLERGY
TYPE(74, 'SHELLFISH', '12-JUN-02', NULL), SIALLERGY_TYPE(68, 'PEANUTS', '13-J
UN-02', NULL), SI_ALLERGY_TYPE(75, 'STRAWBERRIES', '13-JUN-02', NULL))
SI_ALLERGY_TAB()
75 STRAWBERRIES 13-JUN-02
*******Notice the allergy entry of 75, Strawberries, 13-JUN-02 at the
end. This is what I want not all the other exploded data.
SQL> desc si_a31_per_vw
Name Null? Type
........ Omitted uneeded previous column desc because of metalink
character limit but the view is bigger then this.......
DEPT_NAME VARCHAR2(20)
DIV_NAME VARCHAR2(20)
ADDRESSES SI_ADDRESS_TAB
CURRENT_ALLERGIES SI_ALLERGY_TAB
DELETED_ALLERGIES SI_ALLERGY_TAB
SQL> desc si_allergy_tab
si_allergy_tab TABLE OF SI_ALLERGY_TYPE
Name Null? Type
ALG_SEQ NUMBER
ALG_NAME VARCHAR2(50)
START_DATE DATE
STOP_DATE DATE
SQL> desc si_allergy_type
Name Null? Type
ALG_SEQ NUMBER
ALG_NAME VARCHAR2(50)
START_DATE DATE
STOP_DATE DATECan you explain what do you mean by the following?
"PL/SQL tables (a.k.a. Index-by tables) cannot be used as the basis for columns and/or attributes"There are three kinds of collections:
(NTB) Nested Tables
(VAR) Varrying Arrays
(IBT) Index-by Tables (the collection formerly known as "PL/SQL tables")
NTB (and VAR) can be defined as persistent user defined data types, and can be used in table DDL (columns) and other user defined type specifications (attributes).
SQL> CREATE TYPE my_ntb AS TABLE OF INTEGER;
SQL> CREATE TABLE my_table ( id INTEGER PRIMARY KEY, ints my_ntb );
SQL> CREATE TYPE my_object AS OBJECT ( id INTEGER, ints my_ntb );
/IBT are declared inside stored procedures only and have slightly different syntax from NTB. Only variables in stored procedures can be based on IBT declarations.
CREATE PROCEDURE my_proc IS
TYPE my_ibt IS TABLE OF INTEGER INDEX BY BINARY_INTEGER; -- now you see why they are called Index-by Tables
my_ibt_var my_ibt;
BEGIN
NULL;
END;That sums up the significant differences as it relates to how they are declared and where they can be referenced.
How are they the same?
NTB and VAR can also be (non-persistently) declared in stored procedures like IBTs.
Why would you then ever use IBTs?
IBTs are significantly easier to work with, since you don't have to instantiate or extend them as you do with NTB and VAR, or
Many other highly valuable PL/SQL programs make use of them, so you have to keep your code integrated/consistent.
There's a lot more to be said, but I think this answers the question posed by Sri.
Michael -
Only one row appendable at a time in alv
I would like to limit only one blank row at a time in my alv grid. Means, if i append a row using the standard "Append Row" Button, the user should not be able to append a second blank row till he fills out the first one.
Any hints ??
regards,
PriyankHi Sascha,
Thanks for the reply but it does not work.
i put some code in the ...AFTER event, but it seems it is not executed on clicking the append button. I set a breakpoint there but it did not break.
any other suggestions?
my main problem is that when i append multiple rows in the alv and subsequently save the data from this alv grid, somehow one field is getting cleared and not holding the value the user has entered. for example, if i add 5 rows and then put data in these rows and save it, second row shows an initial value for a date field in the table. rest of the rows hold the correct value. i don't know if it is a webdynpro bug or my mistake...i tried redoing everything but to no avail...same problem everywhere.
thus i m trying to restrict the user to one row at a time only. it will be ideal if i can somehow solve the original problem. if not, even restricting to one row will be good enough.
regards,
Priyank -
Report Builder 2.0 returning duplicate rows in query designer
Hi,
I have a query running off a model, when I explore the data in the model and in a standard sql table it returns one row for each record, which include a unique id for each which is correct.
When I go into report builder query designer, it shows duplicate rows for each record. I have removed and added fields to try and pin point why and the only reason i can come up with is that it runs fine until I add in a field thats varchar(255) or
varchar(max). This is when it starts to duplicate the records.
Can anyone tell me why it does this or point me in the direction of how to stop this. I can't edit the query in text to add DISTINCT so thats not an option.
Many thanks,
JJSJOK - I have found a partial answer. By Googling Report Builder and VARCHAR, I found another post which reported problems with the semantic query builder when the underlying table/view was returning columns of type VARCHAR(MAX).
On looking at the length setting for the data column in the DSV, this reported a length of 2,147,483,647 for this field. This is very odd because on querying the underlying table the largest length that I can find for this column is 191,086
(which is far larger than I would have expected - I am investigating this separately).
However, why should the Report Model think that this field contains such a large value?
Anyway, the other post that I found reported that they had solved their problem by converting the field to a VARCHAR (255). I tried this (by casting the column in my View to VARCHAR(255)) and this resolved the problem
- no more duplicate rows when adding this field to the query!!!
I also tried CASTING to TEXT and to VARCHAR(8000). The former did not resolve the problem; the latter did.
So I have a workaround but I don't understand why.
Can anybody explain why having a VARCHAR(max) column in my entity causes duplicate rows.
I suspect it is to do with the fact that for some reason the Report Model seems to think that there is an exceptionally long text string stored in this column in one of the rows but that again is a puzzle.
Thanks
Richard -
Report Queries - Multiple Source queries - One source returns & one doesn't
Hi Folks.
Odd one here.
I have a report query entry in the Shared Components of the APEX UI.
Within the Query are two source queries.
Both return unique column names.
Both use the same bind variable.
When generating a PDF using the call to the report, the data from one query is being returned and the data from another is not.
I have generated a sample XML file from APEX which is populated with data for both queries.
If I import this into MS-Word using the BIP plugin and generate a preview all is fine. All fields using data from both source queries are populated.
When generated via a regular call within APEX it simply does not work. I only get the data from one query.
Does anyone have any suggestions?
Anyone had a similar thing?
Any comments/suggestions welcome.
Many thanks
Dogfighter.
Message was edited by:
Dogfighter
Message was edited by:
DogfighterHi Marc
Does this make sense to you?
I have now set up a simple report query and report layout.
The record ID is hard coded into the query so that it only returns one row.
I am using an RTF based template.
If I navigate to Shared Components > Report Queries > Edit Report Query and then press the 'Test Report' button it runs perfectly.
If I copy the 'Print URL:' value from this page and use it as the URL target on any page in the app. it also works perfectly.
If I try and execute the following...
update invoice_summary
set invoice_pdf = APEX_UTIL.GET_PRINT_DOCUMENT (127, -- App ID
'TEST_INVOICE', -- query name
'TEST_INVOICE') -- layout name
where invoice_summary_gsm_id = a.INVOICE_ID;
I get the pdf saved to the BLOB column with the field labels in place but no data.
Three ways of running the report.
Two of them work perfectly but the one I want (generate direct into BLOB column) does not. Why would the exact same report query & report layout work with the other two methods but not the GET_PRINT_DOCUMENT route?
It's not as if the pdf does not get into the BLOB column, it does, but it only has the labels and no values.
Any ideas?
Simon.
PS. I only have one report query and one report layout set up so as to avoid confusion. Both with the same name.
Message was edited by:
Dogfighter -
Return first row entered based on date column
I'm trying to select the first entered row in a table, as judged by the datetime column. If more than one row has the same date and time, then only one row should be returned (any row having that datetime is fine). Some processing will occur on that row and then it will be deleted. The select statement is used thereafter to select the next (first) entered row in the table, etc. This way, the rows are processed first-in first-out (FIFO) style. Here's my example table:
create table my_table
datetime date,
firstname varchar2(50)
insert into my_table(datetime, firstname) values(to_date('2012-04-02 11:00:00', 'YYYY-MM-DD HH24:MI:SS'),'ken');
insert into my_table(datetime, firstname) values(to_date('2012-04-02 11:00:00', 'YYYY-MM-DD HH24:MI:SS'),'john');
insert into my_table(datetime, firstname) values(to_date('2012-04-02 11:00:00', 'YYYY-MM-DD HH24:MI:SS'),'sue');
commit;
Here's my example select statement, which returns simply one row of the above, since all are the same date and time:
SELECT *
FROM my_table
WHERE datetime = ( select min(datetime) from my_table )
AND rownum = 1;
My question is, if I use the following
SELECT *
FROM my_table
WHERE datetime = ( select min(datetime) from my_table );
It returns all 3 rows:
DATETIME FIRSTNAME
02-APR-12 11:00:00 ken
02-APR-12 11:00:00 john
02-APR-12 11:00:00 sue
So, wouldn't setting rownum = 2 return john, and rownum = 3 return sue? For example,
SELECT *
FROM my_table
WHERE datetime = ( select min(datetime) from my_table )
AND rownum = 2;
return no rows. I just want to make sure I'm understanding how the select statement above works. It seems to work fine for returning one row having the minimum date and time. If this is always the case, then everything is fine. But I wouldn't have expected it not to return one of the other rows when rownum is 2 or 3, which makes me question why? Maybe I can learn something here. Any comments much appreciated.
Edited by: tem on Apr 2, 2012 2:06 PMHi,
tem wrote:
... So, wouldn't setting rownum = 2 return john, and rownum = 3 return sue? For example,, ROWNUM
SELECT *
FROM my_table
WHERE datetime = ( select min(datetime) from my_table )
AND rownum = 2;
return no rows. I just want to make sure I'm understanding how the select statement above works. It seems to work fine for returning one row having the minimum date and time. If this is always the case, then everything is fine. But I wouldn't have expected it not to return one of the other rows when rownum is 2 or 3, which makes me question why? Maybe I can learn something here. Any comments much appreciated.ROWNUM is assigned as rows are fetched and considered for inclusion in the result set. If the row is not chosen for any reason, the same ROWNUM will be reused with the next row fetched. ROWNUM=2 will not be assigned until a row with ROWNUM=1 has been included in hte result set.
So, in your example:
SELECT *
FROM my_table
WHERE datetime = ( select min(datetime) from my_table )
AND rownum = 2;Say the first row that happens to be fetched has firstname='ken'. It is assigned ROWNUM=1, and fails the WHERE clause condition "WHERE rownum = 2".
Say the next row fetched has firstname='john'. ROWNUM=1 hasn't been used yet, so this row is also assigned ROWNUM=1, and it fails the WHERE clause for the same reason. Likewise with the next row; it also is assigned ROWNUM=1, and it also fails.
When using ROWNUM in a WHERE clause, you almost always want to say "ROWNUM = 1" or "ROWNUM <= n".
You could also use the analytic ROW_NUMBER function:
WITH got_r_num AS
SELECT datetime, firstname
, ROW_NUMBER () OVER (ORDER BY datetime) AS r_num
FROM my_table
SELECT datetime, firstname
FROM got_r_num
WHERE r_num = 1
;Here, all values of r_num are available, so it would make sense to say things like "WHERE r_num = 2" or "WHERE r_num >= 2".
Edited by: Frank Kulash on Apr 2, 2012 5:31 PM
Added to explanation. -
Component view only contains external application components
In the project there are two u201Eindependentu201C departments which need to communicate over PI 7.1, which is administered by a third department. There is no SLD in which the u201Cbusiness componentsu201D are registered and hence there are no u201CBusiness Systemsu201D which I could use in PI. At the same time PI doesnu2019t seem to allow having two business components communicate with each other in one integration scenario and returns the error message: u201CComponent view only contains external application componentsu201D. We only need message mapping.
Is there a recommendable solution for this problem without having to build a global SLD for the company?
Regards,
TarikDid you consider using Business Services? I am not sure if they changed the name in PI 7.1 but.. I am talking about having logical systems rather than systems created in SLD.
Also, Integration Scenario is not mandatory as long as you are ready to create the configuration objects manually..!!
VJ -
Ok. So, here is my issue, I am running a query on an oracle 10 database, through pl/sql developer. The result set returns something like this:
ID Code
A 001-012
A 001-021
A 001-032
A 001-043
B 001-023
B 001-054
B 001-003
B 001-002
B 001-007
I would like it to return this
ID Code
A 001-012
B 001-054
The "Code"(ex. 001-043) does not matter, only has to return one for each ID (ex. A), but has to return every unique ID. The problem with it is that there is no one common "Code" for each "ID".
I am sure this makes absolutely no sense...but if it does, and someone out there has any suggestions..would greatly appreciate it :)Shamrock wrote:
N Gasparotto wrote:
Shamrock wrote:
I would like it to return this
ID Code
A 001-012
B 001-054Why those two rows and not others instead ?
I mean, why not the two following ones ?
A 001-021
B 001-003
Are they getting randomly ?
Nicolas.That's the thing, it doesn't matter which row it picks, as long as it only returns one row for each ID. That's why I am struggling I think
Edited by: Shamrock on Jun 16, 2010 7:10 AMIf it doesn't matter which "code" it returns with the distinct "id", why select the "code" in the first place. You just said, in effect, it is meaningless.
just SELECT DISTINCT ID ....
Maybe you are looking for
-
I've been uploading audiobooks from Overdrive and now that I'm done listening to them I want to delete them. After I hook my Ipod 7th gen up to the comp, it pulls up iTunes and I go to Music but I can't find any of the book titles there. They all sho
-
IPhone 4 - transfer all content to new phone?
Hello, My iPhone 4 was accidentally dropped in the sink and was exposed to clean water for a second or two. I immediately fished it out and dried it off with a towel. The phone (screen, buttons) was working, though the sound was no longer working. I
-
FLV not working with Flash 9 player
Ok, strange issue here. I've converted a file to FLV using Flash 8, imported the video into Flash 8 and published it to my site. When I try to view the video in IE (I'm on winXP by the way) using the Flash 8 player it loads correctly and starts playi
-
I just realized my iPhoto Trash won't empty. When I click on it the software crashes. There are about 800 images in the Trash. I tried restoring about half of them to their albums and then emptying Trash -- but same thing -- Crash. Any suggestions? T
-
IMac not going to standby or screensaver.
My iMac doesn't seem to want to go into standby or screensaver, I've set it to go to screensaver after 5 mins of no use yet I've left it way over an hour and still nothing, restarting has no effect, it still goes to sleep but only if I tell it too. W