Home » SQL & PL/SQL » SQL & PL/SQL » Please help, problems refining searches. (Oracle 9i)
Please help, problems refining searches. [message #289307] Thu, 20 December 2007 11:22 Go to next message
Messages: 1
Registered: December 2007
Junior Member
Hi, I'm new to working in oracle and need some help.

I have a select statement that basically recives 6 columns of information. Each column is important. All the columns a series of same results except for the last two. These are date columns.

basiclly there a system where people book orders. These orders have a set of dates to them. Each order has a group of dates accoicated with them. My select statment is giving me a list of every single date, along with there id. So I basically have 60 rows of everything the same except the date.

What I need is just one result showing that has orderid, and single date from the group that fits my criteria. Instead of showing each date on there own. As that query returns 150,000 results. Of which there only should be able 6000. I only have read only access to the database for reporting. So i can't make constraits. Anyone know another way of doing this. Or a way period. thx.

From a total noobie.
Re: Please help, problems refining searches. [message #289311 is a reply to message #289307] Thu, 20 December 2007 11:44 Go to previous message
Messages: 21127
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Could you post a test case? I'm not sure I understood what "(I need) single date from the group that fits my criteria". Which date is that "single date"? How do you set this criteria?

To me, it smells like a GROUP BY question. Just as an example: if you'd like to select minimum date column and the rest of the columns is a "constant", you might try with something like this:
SELECT id, name, MIN(date_column)
FROM this_table
GROUP BY id, name
Previous Topic: Asking about PK & FK Relations
Next Topic: Trigger for Changes in Database
Goto Forum:

Current Time: Fri Jul 21 08:07:13 CDT 2017

Total time taken to generate the page: 0.29181 seconds