19. juni 2008 - 11:35Der er
5 kommentarer og 1 løsning
Simpelt query spørgsmål
Hej, er der nogle af jer skarpe fyre der kan hjælpe med denne. Første sætning fungerer, næste sætning virker ikke, men kan måske give en ide om hvad jeg vil opnå.
Virker: SELECT * FROM (SELECT competitorproduct.refindkey,competitorproduct.name,competitorproduct.url, competitorproduct.category,chain.name as chainname FROM competitorproduct,chain WHERE competitorproduct.chainid = chain.id AND competitorproduct.chainid IN ( SELECT competitorchainid FROM chaincompetition WHERE ownchainid IN( SELECT chainid FROM chainaccess WHERE username = :username AND chainaccesslevel >= 2 ) ) AND UPPER(competitorproduct.name) LIKE UPPER(:search) ORDER BY chainid,name) WHERE ROWNUM <= 300
Virker ikke: SELECT * FROM (SELECT competitorproduct.refindkey,competitorproduct.name,competitorproduct.url, competitorproduct.category,chain.name as chainname,excluded FROM competitorproduct,chain,(SELECT count(*) FROM excludeproduct WHERE excludeproduct.refindkey = competitorproduct.refindkey) as excluded WHERE competitorproduct.chainid = chain.id AND competitorproduct.chainid IN ( SELECT competitorchainid FROM chaincompetition WHERE ownchainid IN( SELECT chainid FROM chainaccess WHERE username = :username AND chainaccesslevel >= 2 ) ) AND UPPER(competitorproduct.name) LIKE UPPER(:search) ORDER BY chainid,name) WHERE ROWNUM <= 300
Hvis det er meget vigtigt at dig som svarer ser tabelstrukturen kan jeg godt poste den, jeg jeg skulle mene at det er til at forstå uden.
Jeg vil gerne se hvor mange gange, hvis overhoved refindkey (som er PK) findes i excludetabellen.
Det fungerer desværre ikke, problemet er at jeg prøver at sammenligne refindkey from den competitorproduct med refindkey i den nestede sætning. fejlen er som flg.:
COMPETITORPRODUCT"."REFINDKEY": invalid identifier SELECT * FROM (SELECT competitorproduct.refindkey,competitorproduct.name,competitorproduct.url, competitorproduct.category,chain.name as chainname,excluded FROM competitorproduct,chain,(SELECT count(*) FROM excludeproduct WHERE excludeproduct.refindkey = *competitorproduct.refindkey) excluded WHERE competitorproduct.chainid = chain.id AND competitorproduct.chainid IN ( SELECT competitorchainid FROM chaincompetition WHERE ownchainid IN( SELECT chainid FROM chainaccess WHERE username = :username AND chainaccesslevel >= 2 ) ) AND UPPER(competitorproduct.name) LIKE UPPER(:search) ORDER BY chainid,name) WHERE ROWNUM <= 300
SELECT * FROM (SELECT competitorproduct.refindkey,competitorproduct.name,competitorproduct.url, competitorproduct.category,chain.name as chainname, (SELECT count(*) FROM excludeproduct WHERE excludeproduct.refindkey = competitorproduct.refindkey) as excluded FROM competitorproduct,chain WHERE competitorproduct.chainid = chain.id AND competitorproduct.chainid IN ( SELECT competitorchainid FROM chaincompetition WHERE ownchainid IN( SELECT chainid FROM chainaccess WHERE username = :username AND chainaccesslevel >= 2 ) ) AND UPPER(competitorproduct.name) LIKE UPPER(:search) ORDER BY chainid,name) WHERE ROWNUM <= 300
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.