| Author |
Topic |
|
ana_jj
Starting Member
6 Posts |
Posted - 2012-05-30 : 12:22:40
|
| What the hell am I missing?? Please help me!select pr.opis, pr.cenafrom parchinja_obleka pr, proizvoditeli p, rezervacii r, klienti kwherepr.prid=p.prid andr.prid=pr.prid andk.klid=r.klid group by pr.opis, pr.cena having count(k.klid)=(select max(maksimum) from (select count(r.klid) as maksimum from rezervacii r,parchinja_obleka pr, proizvoditeli p, klienti kwhere pr.prid=p.prid andr.prid=pr.prid andk.klid=r.klid andr.kupeno='N'group by pr.opis, pr.cena having k.klid=(select k.klid from rezervacii r, trgovski_centri t, butici b, parchinja_obleka pr, klienti k where r.oblid=pr.oblid andr.prid=pr.prid andk.klid=r.klid andr.kupeno='N'order by pr.opis, pr.cena having count(r.oblid)>1 ))) |
|
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2012-05-30 : 12:35:43
|
| You're probably missing sql server?reformatting helps.Looks ok - are you sure that's what you are executing?Try executing parts of it starting at the inner queries and working outwards until you find the issue.I suspect it might be the subquery in the second having clause as that dodesn't really make sense.The having should test an agregate and you have multiple rows returned from a subquery.==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
ana_jj
Starting Member
6 Posts |
Posted - 2012-05-30 : 12:38:56
|
| select pr.opis, pr.cenafrom parchinja_obleka pr, proizvoditeli p, rezervacii r, klienti kwherepr.prid=p.prid andr.prid=pr.prid andk.klid=r.klid group by pr.opis, pr.cena having count(k.klid)=(select max(maksimum) from (select count(r.klid) maksimum from rezervacii r,parchinja_obleka pr, proizvoditeli p, klienti kwhere pr.prid=p.prid andr.prid=pr.prid andk.klid=r.klid andr.kupeno='N'group by pr.opis,pr.cena))This works completly ok, but I need the option for getting those information's where the reservation for the pieces of clothes is more than one. :/ |
 |
|
|
ana_jj
Starting Member
6 Posts |
Posted - 2012-05-30 : 12:44:20
|
| Where can I add this option ?count(r.oblid)>1 |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
ana_jj
Starting Member
6 Posts |
Posted - 2012-05-30 : 12:54:17
|
| Ok Tara, but maybe somebody knows how to handle with my problem :/ |
 |
|
|
AdamWest
Constraint Violating Yak Guru
360 Posts |
Posted - 2012-05-30 : 12:56:46
|
You are wasting time, In my limited experince, you cannot assume that syntax which works in SQL Server will work in Oracle. Even if the sp compiles there with no warnings.It is way different. If I were you I would post your oracle question in oracle.com where they have forums or in stackoverflow.com.You can continue to be stubborn but it's self defeating.quote: Originally posted by ana_jj Ok Tara, but maybe somebody knows how to handle with my problem :/
|
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2012-05-30 : 13:27:18
|
| Sounds like a requirements issue (and I'm not sure what you mean).Do you understand what was wrong with the previous version.The having clause is for checking a value for a group - i.e. an aggregate (usually)You were trying to check each row of a group - yoou could do that in the where clause maybe - perhaps setting an integer value which yoou can sum to get a group value.Don't mind trying to help our disadvantaged brothers. They need our sympathy :).==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|