Forum Replies Created

Viewing 15 posts - 1 through 15 (of 541 total)

  • Reply To: Filter clause query

    Jeffrey Williams wrote:

    I completely missed the different years - so change the where clause to:

    WHERE Balance > 0
    OR (last_modified_date >= '20210401' AND last_modified_date < '20220401')

    So if the item...

  • Reply To: Filter clause query

    Jeffrey Williams wrote:

    homebrew01 wrote:

    How about:

    SELECT  A , B , C ...

    From Table_A

    WHERE ( last_modified_date  between '01/04/2021 00:00:00' and  '31/03/2022 23:59:59' )
    OR ( balance  > 0 and last_modified_date ...

    • This reply was modified 2 years, 5 months ago by  pwalter83.
  • Reply To: Exlude rows when multiple conditions are met

    Mr. Brian Gale wrote:

    If you want to exclude, simply reverse your conditions.  For example, rather than "IN" use "NOT IN" or instead of "<" use ">=".  Or, alternately, toss some brackets around...

  • Reply To: Exlude rows when multiple conditions are met

    Actually I want to exclude rows in the dataset not include based on the condition.

  • Reply To: Exlude rows when multiple conditions are met

    Hi,

    Thanks for your reply.

    just as a general query, could you please help on how to exclude rows in sql if there are multiple conditions involved.

    I will try to build up...

  • Reply To: SSRS optional parameter issue

    Mr. Brian Gale wrote:

    Can they select multiple offices or fol_num's?  If so, then it gets a lot more challenging, but if not, then it should be something like this:

    AND...
  • Reply To: SQL - queries

    aaron.reese wrote:

    Sounds like homework to me...

    AS PP said, no code without DDL and populated tables... but here is my approach:

    Q1: CTE to filter cases to 2010H2, CTE to apply RANK()...

  • Reply To: SQL - queries

    Mr. Brian Gale wrote:

    This sounds like a homework assignment...

    Question 1 is pretty trivial as you are just using datediff on the Cases table with a WHERE to put the date greater than...

  • Reply To: SQL - queries

    Thanks for your kind help. Will try to proceed now.

  • Reply To: Finding error in nested stored procedure

    Thanks, I have tried using Throw as you suggested buts its still showing the same error comment without mentioning the exact stored procedure which is giving the error

  • Reply To: Find rows for a unique ID where value changes in any of the columns

    handkot wrote:

    type sample data

    Please find the DDL and sample data below.

    the requirement is to display the product_ID for the row where the values have changed for the following 5 columns:

    Main_Product

    Product_Colour

    Product_Size

    Tax_Class_ID

    Outer_Print_Name

    Thanks...

    • This reply was modified 4 years, 6 months ago by  pwalter83.
    • This reply was modified 4 years, 6 months ago by  pwalter83.
  • Reply To: Find rows for a unique ID where value changes in any of the columns

    handkot wrote:

    binary_checksum() ?

    Thanks but I need to display the IDs for all the rows for which the values have changed for 4 columns.

     

  • Reply To: String extraction - SQL 2012

    Neil Burton wrote:

    pwalter83 wrote:

    Neil Burton wrote:

    DECLARE 
    @String VARCHAR(100) = 'CKflower2002-pouch-5AR-OneSize'
    select
    SUBSTRING(@string,PATINDEX('%[0-9]%',@string),PATINDEX('%[^0-9a-z]%',@string)-PATINDEX('%[0-9]%',@string))

    That will work for whatever the first delimiter is and for any length of string before the numbers.  It...

  • Reply To: String extraction - SQL 2012

    Neil Burton wrote:

    DECLARE 
    @String VARCHAR(100) = 'CKflower2002-pouch-5AR-OneSize'
    select
    SUBSTRING(@string,PATINDEX('%[0-9]%',@string),PATINDEX('%[^0-9a-z]%',@string)-PATINDEX('%[0-9]%',@string))

    That will work for whatever the first delimiter is and for any length of string before the numbers.  It does assume...

  • Reply To: String extraction - SQL 2012

    Neil Burton wrote:

    select REPLACE(REPLACE(SUBSTRING('CKnovelty2002_pouch-5AR-OneSize',1,CHARINDEX('_','CKnovelty2002_pouch-5AR-OneSize',1) - 1),'CKnovelty',''),'CKflower','')

    Your CHARINDEX was looking for '-' rather than '_'.

    Hi Neil,

    Many thanks for your kind response and it would work well in certain situations....

    • This reply was modified 4 years, 6 months ago by  pwalter83.
    • This reply was modified 4 years, 6 months ago by  pwalter83.

Viewing 15 posts - 1 through 15 (of 541 total)