Hejsa jeg sidder og roder med et lille query i access, som jeg gerne
vil ha lidt udbygget, med det vil ikke lige som jeg gerne vil.
Dette query leverer en stak linier som er i orden:
> SELECT members.cpr,name,address1,address2,members.zip,city,SUM(balance_amount) AS amount
> FROM balance,members,cities
> WHERE balance.cpr = members.cpr AND members.zip = cities.zip
> GROUP BY members.cpr,name,address1,address2,members.zip,city
Min problem er at jeg kun er intereset i de linier hvor amount er
mindre en 0 - dvs noget der ligner:
> SELECT members.cpr,name,address1,address2,members.zip,city,SUM(balance_amount) AS amount
> FROM balance,members,cities
> WHERE balance.cpr = members.cpr AND members.zip = cities.zip AND amount < 0
> GROUP BY members.cpr,name,address1,address2,members.zip,city
eller:
> SELECT members.cpr,name,address1,address2,members.zip,city,SUM(balance_amount) AS amount
> FROM balance,members,cities
> WHERE balance.cpr = members.cpr AND members.zip = cities.zip AND SUM(balance_amount) < 0
> GROUP BY members.cpr,name,address1,address2,members.zip,city
Men ingen af delene virker
Er der nogen der har en ide om hvordan jeg kringler den, uden at
skulle kode det i java-koden skal skal bruge resultatet?
--
Venlig hilsen / Best regards
Henning
_H_P_C_o_n_s_u_l_t_
http://www.hpc.dk
Skoletoften 9, Blans
http://www.turnsys.dk
DK - 6400 Soenderborg