I am Selecting all of the rows from a main table (cms_WhatsHot) along with related rows from other tables (cms_Segments and cms_SegmentsParents) all joined using Inner join. The main table (cms_WhatsHot) will always have rows, the joined tables may have no related rows. The result is that if a...
...by the newly added Row column.
Lets name the result of my original monster query below "MyContactList". I then want to do something like:
SELECT * FROM MyContactList WHERE Row >0 AND Row <11
Is this possible? I thought it might involve using Views or 'WITH' but as I understand it, I can't...
Hi
I hope the title explained the problem accurately. I didn't quite know the best way to describe the problem.
Basically, I am retrieving data from my contacts table using a stored procedure. The procedure is passed one parameter - '@directoryID'.
For each record returned to my ASP.Net app...
Hi
Im would like to know if its possible to create an auto number field to a query so that no matter what your query returns, you'll always have a column starting at 1 and incrementing up for each record.
Example Query:
Select Top 10 TeamScore
From tblTeams
Order By TeamScore
How would I add...
...it out using Random()
Dim r as New Random()
Dim intRan
intRan = r.Next(1000)
Dim objCmd As New OleDbCommand("SELECT TOP 4 PlayerID, Rnd(" & -1 * (intRan) & "*PlayerID) FROM tblPlayers WHERE PositionID='defender' ORDER BY Rnd(" & -1 * (intRan) & "*PlayerID)", objConn)
Previously, we were...
...it out using Random()
Dim r as New Random()
Dim intRan
intRan = r.Next(1000)
Dim objCmd As New OleDbCommand("SELECT TOP 4 PlayerID, Rnd(" & -1 * (intRan) & "*PlayerID) FROM tblPlayers WHERE PositionID='defender' ORDER BY Rnd(" & -1 * (intRan) & "*PlayerID)", objConn)
Previously, we were...
...but subsequent runs will return different records.
SELECT TOP 4 PlayerID
FROM tblPlayers
WHERE PositionID='defender'
ORDER BY rnd(isnull(PlayerID)*0+1);
This is where I got to in a different thread (before I knew what the problem was)
Woja wrote:
"You need to use the Randomize statement...
...E as EventArgs)
Dim objCmd As New OleDbCommand("SELECT TOP 4 PlayerID FROM tblPlayers WHERE PositionID='defender' ORDER BY rnd(isnull(PlayerID)*0+1);", objConn)
Try
objConn.Open()
dgDef.DataSource = objCmd.ExecuteReader
dgDef.DataBind()
objConn.Close()
Catch ex as...
OK, error above was due to incorrectly declaring Random(). I code the code to work but it still returns the same set of data. How do I change the seed that Access uses to create the Random from with my .Net page?!
Many thanks
Shaun
...intRan = r.Next(3)
Dim objCmd As New OleDbCommand("SELECT TOP 4 PlayerID FROM tblPlayers WHERE PositionID='defender' ORDER BY rnd(isnull(PlayerID)*0+" & intRan & ");", objConn)
Try
...
But I get the error: 'Next' is not a member of 'System.Array'
My thinking behind the above was...
...E as EventArgs)
Dim objCmd As New OleDbCommand("SELECT TOP 4 PlayerID FROM tblPlayers WHERE PositionID='defender' ORDER BY rnd(isnull(PlayerID)*0+1);", objConn)
Try
objConn.Open()
dgDef.DataSource = objCmd.ExecuteReader
dgDef.DataBind()
objConn.Close()
Catch ex as...
Golom - job done. Thank you.
Can I just ask where 'NZ' comes from. I get lost in the query at that point. Is it just a variable name?
Plus it helps so mucg when you layout the query this way. I didn't realise access allowed this.
Many thanks
Hi
I have the following query:
SELECT ft.FantasyTeamID, ft.TeamName, fp.FantasyTeamPlayerID, p.PlayerName, p.PositionID
FROM tblFantasyTeams AS ft, tblFantasyTeamPlayers AS fp, tblPlayers AS p, tblGoals as g
WHERE p.PlayerID = fp.PlayerID AND fp.FantasyTeamID = ft.FantasyTeamID AND...
Hi
I'm hoping someone could give me a hand with what seems to be an impossible task.
I have a table of website hits. Each record contains the following:
HitID
CreationDate
IPAddress
DevelopmentID
All are self explainatory apart from DevelopmentID. Basically, the site is a portal that leads...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.