Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2009
    Posts
    1

    Unanswered: Sql raporting - multi value in the raport parameters

    Hi

    I have a table with 4 columns (Date, Name, Surname, Number). Date format is yyyymmdd. My goal is to extract month and group members by February till exempel, so i wrote a sql code:

    Select * From Table_2 Where substring(Date, 5,2)=@Month and a declared values January is 01, February is 02 to the @Month

    I created a rapport and everything is all rigt until i check "multi value" in the "Raport parameters". With my code i can select only one month, and it works.

    I will select a few months and i understand that my code is wrong but i dont know how to write a good one. I understand that my code doesnt work because
    Select * From Table_2 Where substring(Date, 5,2)=@Month and @Month is 01,02 if i select January and February att the same time. It can not select 01,02 with my code because my code selects only 2 letters. I must split 01,02 somehow into two separate strings. I think that i must create some kind of loop. (i am new in sql, but i understand php and mysql. In this kind of situation i usually create array in php and write loop and extract that what i want, and i "feel" that i can not think with same logic with this sql question)

    Can anybody help me?

  2. #2
    Join Date
    Dec 2007
    Location
    Richmond, VA
    Posts
    1,328
    Provided Answers: 5
    think about IN, BETWEEN or >=/<=.
    Dave

Tags for this Thread

Posting Permissions

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