Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. shauns1

    I think Inner Join problem

    Bingo! Thanks mate.
  2. shauns1

    I think Inner Join problem

    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...
  3. shauns1

    Using Views or 'WITH' to query a query.

    ...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...
  4. shauns1

    Compare a field to a variable in one table whilst querying another

    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...
  5. shauns1

    Can you append an auto number field to a query?

    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...
  6. shauns1

    Getting access to retrieve different random records on each request

    ...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...
  7. shauns1

    Problem getting random records

    ...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...
  8. shauns1

    Getting access to retrieve different random records on each request

    ...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...
  9. shauns1

    Getting access to retrieve different random records on each request

    Hi Doesn't myLong + 1 just = 1? Or am I mixing up Long with integer? Thanks - just trying to understand whats going on.
  10. shauns1

    Getting access to retrieve different random records on each request

    ...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...
  11. shauns1

    Problem getting random records

    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
  12. shauns1

    Problem getting random records

    ...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...
  13. shauns1

    Problem getting random records

    ...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...
  14. shauns1

    Problem with Join and Count in the same query

    Oh right, I see. Thanks for the clarification.
  15. shauns1

    Problem with Join and Count in the same query

    I see. But was 'NZ' just a variable name?
  16. shauns1

    Problem with Join and Count in the same query

    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
  17. shauns1

    Problem with Join and Count in the same query

    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...
  18. shauns1

    Killer Query

    You make it look sooo easy. I think this does the job for now. I will work with it over the next few days to test. Many thanks for your help! Shaun
  19. shauns1

    Killer Query

    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...

Part and Inventory Search

Back
Top