Solved

How to convert this MySQL Query to SQL Server Query?

Posted on 2012-03-20
1
438 Views
Last Modified: 2012-06-21
Hi,

I would like to know how to convert this MySQL Server Query:

SELECT * FROM [i]table[/i] WHERE [i]column[/i] BETWEEN DATE_SUB(curdate(), INTERVAL 8 WEEK) AND CURDATE() ORDER BY views DESC

Open in new window


To a SQL Server Query?

Thank you
0
Comment
Question by:marcoloppo
1 Comment
 
LVL 11

Accepted Solution

by:
dougaug earned 500 total points
ID: 37745617
select * from table where column between dateadd(ww, -8, getdate()) and getdate()
order by views DESC
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
mysql qry 1 26
Need SSIS project 2 30
SQL Server Express or Standard? 5 34
Specify timing interval fro change data 2 57
I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question