Home » SQL & PL/SQL » SQL & PL/SQL » SQL
SQL [message #381887] Tue, 20 January 2009 04:05 Go to next message
MrD99
Messages: 2
Registered: January 2009
Junior Member
Hi!
I'm very new to oracle, and have a sql problem.

I have two tables. There is no connection between them (except one insignificant field).

Table one: owner
owner information of a store

Table two: wine
information about wines, with a date field.

Now, what I have to do is to check if there is a new wine added today. If there is, I have to select the owner from table one.

The only field they have in common "store". Owners have a field identifying what store they own, and each wine have the same field identifying what store they belong to.

I know this is not a logical selection, but the software I'm using limits me to doing it this way.

Is there any way to write a selection like this?

IF
select count(*) from wine where date = today and store = 1
THEN
select * from owner where store = 1

I do not want to select anyting from the wine table.

Thanks for all your help!
Re: SQL [message #381889 is a reply to message #381887] Tue, 20 January 2009 04:11 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Please read OraFAQ Forum Guide, especially "How to get a quick answer to your question?" and "How to format your post?" sections.

Post a Test case: create table and insert statements along with the result you want with these data.
Also always post your Oracle version (4 decimals).

Regards
Michel
Re: SQL [message #381907 is a reply to message #381889] Tue, 20 January 2009 04:28 Go to previous messageGo to next message
MrD99
Messages: 2
Registered: January 2009
Junior Member
The thing is that I have very little acces to any oracle, just thourg a business software. So I can't even get the version number.

Thats why I'm open to any sugestion.
Re: SQL [message #381917 is a reply to message #381907] Tue, 20 January 2009 04:55 Go to previous message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
This does not prevent your from posting create table and insert statements.

Regards
Michel
Previous Topic: file write error
Next Topic: executing a procedure
Goto Forum:
  


Current Time: Sat Dec 03 09:53:31 CST 2016

Total time taken to generate the page: 0.05269 seconds