Connecting Tech Pros Worldwide Forums | Help | Site Map

sql problem - how to write this in sql

Foxie Foxster
Guest
 
Posts: n/a
#1: Nov 12 '05
i have two tables nl tblLEV and tblPOINTS (each with a certain number of
fields)

now i wrote the following sql

sqltekst= "SELECT DISTINCTROW tblLEV.LEVname, tblPOINTS.* from tblLEV inner
join tblPOINTS ON tblLEV.levid=tblPOINTS.pointsid ORDER BY levpt DESC,
levpt1 DESC


comment: levpt en levpt are fields from table tblLEV and the ordening works
fine

but now the problem.......................

there are numeric fields in tblPOITS points1, points2 and I want to complete
the order with

sum(points1) DESC, sum(points2) DESC


questions:
in qsl is summating sum(points)????
if not how is it done????

can anyone understand what i'm saying or give me some advice???

thx and greetigns



DFS
Guest
 
Posts: n/a
#2: Nov 12 '05

re: sql problem - how to write this in sql


I think you want something like:

SELECT L.LevName, Sum(P.Points1) as SumPoints1, Sum(P.Points2) as SumPoints2
FROM tblLEV L INNER JOIN tblPOINTS P
ON L.LevID = P.PointsID
GROUP BY L.LevName
ORDER BY Sum(P.Points1) DESC


"Foxie Foxster" <verik.reynaert@skynet.be> wrote in message
news:3fcf2d72$0$2871$ba620e4c@reader1.news.skynet. be...[color=blue]
> i have two tables nl tblLEV and tblPOINTS (each with a certain number[/color]
of[color=blue]
> fields)
>
> now i wrote the following sql
>
> sqltekst= "SELECT DISTINCTROW tblLEV.LEVname, tblPOINTS.* from tblLEV[/color]
inner[color=blue]
> join tblPOINTS ON tblLEV.levid=tblPOINTS.pointsid ORDER BY levpt DESC,
> levpt1 DESC
>
>
> comment: levpt en levpt are fields from table tblLEV and the ordening[/color]
works[color=blue]
> fine
>
> but now the problem.......................
>
> there are numeric fields in tblPOITS points1, points2 and I want to[/color]
complete[color=blue]
> the order with
>
> sum(points1) DESC, sum(points2) DESC
>
>
> questions:
> in qsl is summating sum(points)????
> if not how is it done????
>
> can anyone understand what i'm saying or give me some advice???
>
> thx and greetigns
>
>[/color]


Foxie Foxster
Guest
 
Posts: n/a
#3: Nov 12 '05

re: sql problem - how to write this in sql


thx for reply

so in the order it is possible to calculate

and well

order SUM(points)

though that doesn't work with me......

must there be a calculation after the SELECT WORD????


"DFS" <nospamDS@nospam.com> schreef in bericht
news:vsugr61eumbqd0@corp.supernews.com...[color=blue]
> I think you want something like:
>
> SELECT L.LevName, Sum(P.Points1) as SumPoints1, Sum(P.Points2) as[/color]
SumPoints2[color=blue]
> FROM tblLEV L INNER JOIN tblPOINTS P
> ON L.LevID = P.PointsID
> GROUP BY L.LevName
> ORDER BY Sum(P.Points1) DESC
>
>
> "Foxie Foxster" <verik.reynaert@skynet.be> wrote in message
> news:3fcf2d72$0$2871$ba620e4c@reader1.news.skynet. be...[color=green]
> > i have two tables nl tblLEV and tblPOINTS (each with a certain number[/color]
> of[color=green]
> > fields)
> >
> > now i wrote the following sql
> >
> > sqltekst= "SELECT DISTINCTROW tblLEV.LEVname, tblPOINTS.* from tblLEV[/color]
> inner[color=green]
> > join tblPOINTS ON tblLEV.levid=tblPOINTS.pointsid ORDER BY levpt DESC,
> > levpt1 DESC
> >
> >
> > comment: levpt en levpt are fields from table tblLEV and the ordening[/color]
> works[color=green]
> > fine
> >
> > but now the problem.......................
> >
> > there are numeric fields in tblPOITS points1, points2 and I want to[/color]
> complete[color=green]
> > the order with
> >
> > sum(points1) DESC, sum(points2) DESC
> >
> >
> > questions:
> > in qsl is summating sum(points)????
> > if not how is it done????
> >
> > can anyone understand what i'm saying or give me some advice???
> >
> > thx and greetigns
> >
> >[/color]
>
>[/color]


DFS
Guest
 
Posts: n/a
#4: Nov 12 '05

re: sql problem - how to write this in sql


Foxie,

Sorry, but I'm having a hard time understanding what you're asking. Did
that query I wrote not work? What happened? What results do you want to
see?

Post your table structures and maybe it'll be more clear.




"Foxie Foxster" <verik.reynaert@skynet.be> wrote in message
news:3fcf69d8$0$279$ba620e4c@reader4.news.skynet.b e...[color=blue]
> thx for reply
>
> so in the order it is possible to calculate
>
> and well
>
> order SUM(points)
>
> though that doesn't work with me......
>
> must there be a calculation after the SELECT WORD????
>
>
> "DFS" <nospamDS@nospam.com> schreef in bericht
> news:vsugr61eumbqd0@corp.supernews.com...[color=green]
> > I think you want something like:
> >
> > SELECT L.LevName, Sum(P.Points1) as SumPoints1, Sum(P.Points2) as[/color]
> SumPoints2[color=green]
> > FROM tblLEV L INNER JOIN tblPOINTS P
> > ON L.LevID = P.PointsID
> > GROUP BY L.LevName
> > ORDER BY Sum(P.Points1) DESC
> >
> >
> > "Foxie Foxster" <verik.reynaert@skynet.be> wrote in message
> > news:3fcf2d72$0$2871$ba620e4c@reader1.news.skynet. be...[color=darkred]
> > > i have two tables nl tblLEV and tblPOINTS (each with a certain[/color][/color][/color]
number[color=blue][color=green]
> > of[color=darkred]
> > > fields)
> > >
> > > now i wrote the following sql
> > >
> > > sqltekst= "SELECT DISTINCTROW tblLEV.LEVname, tblPOINTS.* from tblLEV[/color]
> > inner[color=darkred]
> > > join tblPOINTS ON tblLEV.levid=tblPOINTS.pointsid ORDER BY levpt DESC,
> > > levpt1 DESC
> > >
> > >
> > > comment: levpt en levpt are fields from table tblLEV and the ordening[/color]
> > works[color=darkred]
> > > fine
> > >
> > > but now the problem.......................
> > >
> > > there are numeric fields in tblPOITS points1, points2 and I want to[/color]
> > complete[color=darkred]
> > > the order with
> > >
> > > sum(points1) DESC, sum(points2) DESC
> > >
> > >
> > > questions:
> > > in qsl is summating sum(points)????
> > > if not how is it done????
> > >
> > > can anyone understand what i'm saying or give me some advice???
> > >
> > > thx and greetigns
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]


Closed Thread


Similar Microsoft Access / VBA bytes