#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2012
    Posts
    2
    Rep Power
    0

    Convert MS SQL into PostgresSQL


    Hi,
    i am new to this site and i hope i get some help. i have this sql code in which i wrote in ms sql server and it works fine but i have tried in Postgress and i am gettng error. Can someone help me to convert this? many thanks

    here is the code:
    SELECT
    DATEADD(WEEK, DATEDIFF(WEEK, 0, date), 0) AS Week_Start_Date,
    Visitor,
    COUNT(DISTINCT date) AS [UniqDays]
    FROM dbo.visitor
    WHERE
    date >= @startDate
    GROUP BY
    DATEADD(WEEK, DATEDIFF(WEEK, 0, date), 0), Visitor
    HAVING
    COUNT(DISTINCT date) >= 3
    ORDER BY
    DATEADD(WEEK, DATEDIFF(WEEK, 0, date), 0), Visitor
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2012
    Posts
    9
    Rep Power
    0
    You're basically asking us to do all of the work for you.
    If you get started on the process of writing the postgres query, post what you've tried, and we can help you out if you get stuck.
    Also, tell us what you're trying to do and give us some sample data, please.

    Thanks.

IMN logo majestic logo threadwatch logo seochat tools logo