Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

How to convert this MySQL Query to SQL Server Query?

Posted on 2012-03-20
1
437 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
PHP query / monitor data from Telnet to MySQL 7 43
Re-appearing SQL Server Agent jobs 7 28
TSQL Challenge... 7 35
SQL Quer 4 21
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
I have a large data set and a SSIS package. How can I load this file in multi threading?
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

792 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