Forum Replies Created

Viewing 5 posts - 1 through 5 (of 5 total)

  • RE: Need help with SQL Query

    Try this

    WITH cte AS

    (

    SELECT machine_id,

    CASE WHEN DATEDIFF('m', firstseen, getdate()) = 0 THEN 'AUG'

    ...

  • RE: Calculating date

    This query will not give correct output in this case

    create TABLE t1 (ID INT, Date DATETIME, [User] VARCHAR(10), Action VARCHAR(10))

    INSERT INTO t1

    SELECT 22, '8/16/2012 12:10:36', 'A', 'Something'

    UNION ALL SELECT 2,...

  • RE: aggregation, group by clause, need help tweakng query

    Change your query to look like this

    select inv_number, round(SUM(l.line_units * p.p_price), 2) as "Invoice Total"

    from line l

    join product p

    on l.p_code = p.p_code

    group by inv_number

  • RE: aggregation, group by clause, need help tweakng query

    Change your query to look like this.

    select inv_number, round(SUM(l.line_units * p.p_price), 2) as "Invoice Total"

    from line l

    join product p

    on l.p_code = p.p_code

    group by inv_number;

  • RE: Three table query problem in stored procedure

    Try this query. It will work.

    SELECT f.ForumId,f.Title,f.Intro,count(t.ThreadId) AS [Thread Count],count(p.PostId) AS [Post Count] FROM

    Forum f inner join Thread t on f.ForumID = t.ForumID

    inner join Post p on t.ThreadId...

Viewing 5 posts - 1 through 5 (of 5 total)