locked
Multiple values RRS feed

  • Question

  • User-853847052 posted

    I've a list of record and I would like to see only the multiple of 3

    campo - coupon - OK - Data
    record 1 - 111
    record 2 - 222
    record 3 - 111
    record 4 - 111
    record 5 - 111
    record 6 - 111
    record 7 - 333
    record 8 - 111
    record 9 - 333
    record 10 - 111
    record 11 - 333
    record 12 - 333
    record 13 - 111
    record 14 - 111
    record 15 - 333
    record 16 - 111
    record 17 - 333
    record 18 - 333
    record 19 - 111
    record 20 - 333
    record 21 - 222
    record 22 - 222

     

    I've 11 records with 111
    8 records with 333
    ...


    I would like to see only the multiple of 3:

    9 - 111
    6 - 333
    3 - 222

     

     and update these records with OK set to true .... starting with the records with the old date ...

     Thanks

     

    Tuesday, May 19, 2009 7:13 PM

Answers

  • User1189484468 posted

    I'm not entirely sure that I understand what you want to do. In order to select every third record in the Access database, you can create a calculated field that determines whether the ID is divisible by 3, and then select by that field. Here's an example of an Access SQL query that does that for a table named "nixor":

     

    SELECT Nixor.[ID], Nixor.[Coupon], Nixor.[EnterDate], IIf(([ID] Mod 3=0),1,0) AS EveryThird
    FROM Nixor
    WHERE (((IIf(([ID] Mod 3=0),1,0))=1));

     

    Is this even close to what you have in mind?  

     

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, May 20, 2009 3:44 PM

All replies

  • User1189484468 posted
    You have this in the Access databases forum -- are you trying to do this in Access specifically? (As in, craft an Access query that will do this?) Or is a solution in ASP.NET code ok? (If so, what language do you prefer working in?)
    Wednesday, May 20, 2009 12:48 AM
  • User-853847052 posted

    My DB is Access!!

    I can do this with DB (query) or .NET code ... this isn't  a problem for me!

    Thanks for help me!

    Wednesday, May 20, 2009 4:05 AM
  • User1189484468 posted

    I'm not entirely sure that I understand what you want to do. In order to select every third record in the Access database, you can create a calculated field that determines whether the ID is divisible by 3, and then select by that field. Here's an example of an Access SQL query that does that for a table named "nixor":

     

    SELECT Nixor.[ID], Nixor.[Coupon], Nixor.[EnterDate], IIf(([ID] Mod 3=0),1,0) AS EveryThird
    FROM Nixor
    WHERE (((IIf(([ID] Mod 3=0),1,0))=1));

     

    Is this even close to what you have in mind?  

     

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, May 20, 2009 3:44 PM