Forum Replies Created

Viewing 15 posts - 31 through 45 (of 216 total)

  • RE: Most tricky

     

    Hi David ,

    Above query u given is working only in case of a table contain all duplicate records..

    But if there are some records which are disstinct it will not work...

    I have slightly...

  • RE: MAX() aggregate function with NULLS

    Hi ,

    Try this solution.........

    select clientid , min(date_in) ,

      case when max(isnull(date_out,GETDATE()))= getdate()

      THEN NULL

     ELSE max(date_out)

    END [MAX_DATE]

     from client

    group by clientid

     

    Regards

  • RE: Query to pick columns from multiple tables

    Hi ,

    Use the following query!! It's working..

     

    SELECT a.e_id,a.name,a.address,

    (case when datepart(qq,dt)=1 then sum(salary) else 0 end) QT_1 ,

    (case when datepart(qq,dt)=2 then sum(salary) else 0 end) QT_2 ,

    (case when datepart(qq,dt)=3 then sum(salary)...

  • RE: Quote Identifier

    Hi ,

    use a replace function where u r populating the data into table.. e.x..

    Select Replace('abc''nhju','''','''''') or

    remove the apostrophee..from name

    Select Replace('abc''nhju','''','')

     

    Regards ,

    Amit Gupta..

     

     

  • RE: help with stored procedure error message

    Hi ,

    The columns u have used in the query r not valid.

    Please verify. The column names u have used..

     

    Regards,

    Amit Gupta..

     

  • RE: Balance calculation of budget minus expenses

    Hi ,

    Can u send the sample data to me.. so that i can check my logic..

    Anyway as per ur requirement i can send u a script which is given below...

  • RE: Run-time error 80040e07

    It is a data length problem.. the field in which ur inserting the data has less size difined..

    Please check the values which ur inserting..

     

    Regards ,

    Amit Gupta..

     

     

  • RE: One more SQL puzzle

    Hi ,

    Try this script . it will solve ur problem..

     

    select * from tab_a

    union

    select distinct j.* from (

    select distinct z.b,k.name from(

    select * from (

    select a.i_d,count(*) b from (

    select * from...

  • RE: Text Date Comparison

    Hi ,

    David first you have to see the format of record_date for e.g.

    MY Record_Dtae field which contain a date value like "20070308' so iwill use the query like :

    select

  • RE: parsing help

    Hi,

    But as per given requirement it is working fine...

     

    Regards

    Amit

  • RE: parsing help

    Hi ,

    Try This.. Its working..

    select * from full_name1 a ,

     full_name2 b

    where soundex(a.col_1)=soundex(b.col_1)

     

    Regards ,

    Amit G.

     

  • RE: Trying to get one aggregate set from two different tables

    Hi ,

    Try This....Its working

    select txtPriorCarrier,count(*)  a from(

    select * from PreviousCarrierForBA

    union all

    select * from PreviousCarrierForwc)a

    group by txtPriorCarrier

    order by 2 desc

     

    Regards,

    Amit G.

  • RE: Minimum of detail table

    Hi ,

    I know U  r problem is know solved.. Take a look this one to solve ur problem...

    select * from  tblLineItems a

    where  reqdby in (select min(reqdby) from tblLineItems group by...

  • RE: Can anyone solve the SQL puzzle ?

    Hi ,

    Excellent Question and very good answer by Td Wilson ...

    Good One Boss..............

     

    Regards ,

    Amit Gupta...

     

     

  • RE: simple update statement

    Hi ,

    This query might help you....

    Update B set Code=substring(a.id,2,len(a.id)) from table a join table b on left(a.id,1)=b.id

    Regards ,

    Amit Gupta

Viewing 15 posts - 31 through 45 (of 216 total)