Distinct records only

Ask a Question related to Dreamweaver AppDev, Design and Development.

  1. #1

    Default Distinct records only

    Hi

    I'm building a gallery app in vb.net with sql2000 and am sort of stuck so
    any advice would be gratefully received, heres the trouble
    I have a user control that displays latest photos populated from an SP
    (Select iFilename, iDate, iUserID from tblImages order by iDate Desc)
    works like a charm however if a user uploads 5 photos all the latest photos
    on the homepage will be theirs. I'd like to only retrieve only records with
    a unique userID

    I tried
    Select distinct iUserID iFilename, iDate, from tblImages order by iDate Desc

    but it didn't work, I tried google but didn't find anything similar and a
    few others that only retrieved totally unique records.

    I'm up against a deadline and this is the last bit so any advice gratefully
    received


    ossie Guest

  2. Similar Questions and Discussions

    1. SQL Distinct
      I want to select distinct value from one field of the table and select rest of the corresponding fields accordingly. I have a table that has fields:...
    2. need help on DISTINCT
      Hi ALl, I need some help on DISTINCT in a query I'm trying to run. I have two tables which are linked. This is the query I use: SQL = "SELECT...
    3. return distinct
      Is this what you are looking for.(check the group by clause) SELECT TOP 100 PERCENT dbo.tbl_purchase_order_lines.stock_code,...
    4. SELECT DISTINCT + ORDER BY gives ERROR 145: ORDER BY items must appear in the select list if SELECT DISTINCT is specified.
      Following is my stored procedure. If I take the DISTINCT out then everything works fine. BUT I need the distinct because it returns duplicate...
    5. SELECT DISTINCT + ORDER BY gives ERROR 145: ORDER BY items mustappear in the select list if SELECT DISTINCT is specified.
      Dan, You should be able to do this: SELECT Id, FaxID, ReceivedTime, Pages FROM ( SELECT DISTINCT .Id AS Id,
  3. #2

    Default Re: Distinct records only

    The problem with Distinct is that it works against the whole line of code
    and with the file name being specified then it will never limit itself on
    the userid alone.

    You could try creating two queries to loop through a list of distinct ID,
    however a simple method may be to use some conditional login on the page to
    only display a second image if the UserID assocuated with in is not the same
    as the first.

    --
    Regards

    Paul Whitham
    Macromedia Certified Professional for Dreamweaver MX2004
    Valleybiz Internet Design
    [url]www.valleybiz.net[/url]

    Team Macromedia Volunteer for Ultradev/Dreamweaver MX
    [url]www.macromedia.com/support/forums/team_macromedia[/url]

    "ossie" <forums@microsoft.com> wrote in message
    news:cvf9k4$olb$1@forums.macromedia.com...
    > Hi
    >
    > I'm building a gallery app in vb.net with sql2000 and am sort of stuck so
    > any advice would be gratefully received, heres the trouble
    > I have a user control that displays latest photos populated from an SP
    > (Select iFilename, iDate, iUserID from tblImages order by iDate Desc)
    > works like a charm however if a user uploads 5 photos all the latest
    photos
    > on the homepage will be theirs. I'd like to only retrieve only records
    with
    > a unique userID
    >
    > I tried
    > Select distinct iUserID iFilename, iDate, from tblImages order by iDate
    Desc
    >
    > but it didn't work, I tried google but didn't find anything similar and a
    > few others that only retrieved totally unique records.
    >
    > I'm up against a deadline and this is the last bit so any advice
    gratefully
    > received
    >
    >

    Paul Whitham TMM Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139