Results 1 to 8 of 8

Thread: SQL Syntax Question - LIKE Operator

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #8
    VBAX Master XLGibbs's Avatar
    Joined
    Jan 2006
    Location
    state of confusion, but vacation in denial
    Posts
    1,315
    Location
    Malik,

    If you have multiple criteria, it makes sense to use the second table and either do:
    Select Sum(Table.Items)
    From Table
    Where TI.[CriteriaField] in (Select CriteriaColumn FRom CriteraTable)
    You can also link using a join
    Select Sum(Table.Items)
    From Table inner join CriteriaTable on Table.FieldName = CriteriaTable.Criterea
    Which would only return the sum of matching rows where the criteria field in Table matches the values in the Criteria table.

    You can also use dynamic SQL, but with that many variables and LIKE syntax..it gets "messy"
    Last edited by Aussiebear; 03-21-2025 at 06:20 AM.
    If you have posted the same question at multiple forums, please read this IMPORTANT INFO.

    Please use the thread tools to mark your thread Solved


    Please review the Knowledge Base
    for samples and solutions , or to submit your own!




Posting Permissions

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