SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    Afrika
    Join Date
    Jul 2004
    Location
    Nigeria
    Posts
    1,737
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    MS SQL: Join query DONT WORK on ASP pages

    hello,
    am using a join query below to get multiple results from different related tables to form one. e.g

    SELECT DISTINCT dbo.e_Wallet.subscriptions, dbo.e_Wallet.username, dbo.e_Wallet.status, dbo.e_Wallet.suspension, dbo.ewalletx_yr_registratn.email, dbo.ewalletx_yr_registratn.Fiscal_Yr, dbo.ewalletx_yr_registratn.end_date, dbo.e_walletpurse.purse
    FROM dbo.e_Wallet INNER JOIN dbo.ewalletx_yr_registratn ON dbo.e_Wallet.registrationID = dbo.ewalletx_yr_registratn.registrationID AND dbo.e_Wallet.email = dbo.ewalletx_yr_registratn.email LEFT OUTER JOIN dbo.e_walletpurse ON dbo.e_Wallet.email = dbo.e_walletpurse.email AND dbo.e_Wallet.registrationID = dbo.e_walletpurse.regID
    WHERE username = 'variable'


    however it dosent seem to work or show any results on my asp page.

    What is wrong here ?

    thanks

  2. #2
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have you tried putting parentheses around the first join operation, eg

    SELECT DISTINCT
    dbo.e_Wallet.subscriptions,
    dbo.e_Wallet.username,
    dbo.e_Wallet.status,
    dbo.e_Wallet.suspension,
    dbo.ewalletx_yr_registratn.email,
    dbo.ewalletx_yr_registratn.Fiscal_Yr,
    dbo.ewalletx_yr_registratn.end_date,
    dbo.e_walletpurse.purse
    FROM (dbo.e_Wallet INNER JOIN dbo.ewalletx_yr_registratn
    ON dbo.e_Wallet.registrationID = dbo.ewalletx_yr_registratn.registrationID
    AND dbo.e_Wallet.email = dbo.ewalletx_yr_registratn.email)
    LEFT OUTER JOIN dbo.e_walletpurse
    ON dbo.e_Wallet.email = dbo.e_walletpurse.email
    AND dbo.e_Wallet.registrationID = dbo.e_walletpurse.regID
    WHERE username = 'variable'

  3. #3
    Original Gangster silver trophy Thing's Avatar
    Join Date
    Oct 2000
    Location
    Philadelphia, PA
    Posts
    4,708
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by afrika
    however it dosent seem to work or show any results on my asp page.
    If your not getting an error message, than your query is fine it just isn't matching any records.

  4. #4
    Afrika
    Join Date
    Jul 2004
    Location
    Nigeria
    Posts
    1,737
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    when i run the same query on query analyzer, it gives the desired result.

    Well, i would check to see if the problem is with the variable

    thanks


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •