Question

Locked

How to select only a single data from many record?

By leynaixora ·
Hi,
I 'm trying to select data from oracle database to excel. I faced difficulty to select one data for each id, where for one id, we got many row.
The other one is how to make sure that the id is selected from database match properly with the id that already in excel.
The connection between database and excel can establish, I think the sql statement should be changed. Anyone can help me with sql syntax? Any assistance would be greatly appreciated.

Thanks.

This conversation is currently closed to new comments.

4 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

Well you need some way of identifying

by Tony Hopkinson In reply to How to select only a sing ...

which one of the many you want.

The 'first' one would be
Select Top 1 * From MyTable Where MyID = ?

Or if there's some sort of ordering in there

Select Top 1 * From MyTable Where MyID = ? Order By SomeField

HtHs

Collapse -

Reponse To Answer

by leynaixora In reply to Well you need some way of ...

Thanks for your opinion. But it still not working. I need to select the first one data and make sure it match with the id already in excel.

Collapse -

Reponse To Answer

by Tony Hopkinson In reply to Well you need some way of ...

Your description suggested you were executing a query soemtheing like
Select * From Some SameTable Wher SomeID = [A1]

Where A1 is the id you want, but that that there is more than one record in teh table for that ID, therefore use Top or some such.

If it isn't the same id then obviously that isn't what you are doing

So if the id does n't match, what are you doing

Back to Software Forum
4 total posts (Page 1 of 1)  

Related Discussions

Related Forums