Solved

SQL Query between two tables

Posted on 2012-04-11
4
296 Views
Last Modified: 2012-04-11
Greetings,
I am trying to use the following query to draw out articles from one table based on their date and a keyword and then sort through the description column in the article table looking for international cities to tie that article to.  For instance:

SELECT  Article.Date, Article.Title, Article.Link, City.City, City.Latitude, City.Longitude FROM Article INNER JOIN City
ON City.City Like '%' + Article.Description + '%' WHERE Article.IndexGUID='f50c528b-230f-4732-b3a9-138c7af039c2' AND
Article.Date BETWEEN '1/1/2012' AND '3/1/2012' AND Article.Title LIKE '%computer%' GROUP BY Article.Date, Article.Title,
Article.Link, City.City, City.Latitude, City.Longitude ORDER BY Article.Date DESC

For some reason this query doesn't work.  Any help would be extremely appreciated.  Thanks in advance.
0
Comment
Question by:MaxKroy
  • 2
  • 2
4 Comments
 
LVL 20

Expert Comment

by:BuggyCoder
Comment Utility
you are doing group by and no aggregate function is used in select statement.
please re-check what you are trying to achieve here...
0
 

Author Comment

by:MaxKroy
Comment Utility
that doesn't help..thanks though??
0
 
LVL 20

Accepted Solution

by:
BuggyCoder earned 500 total points
Comment Utility
Try this:-

SELECT  Article.Date, Article.Title, Article.Link, City.City, City.Latitude, City.Longitude FROM Article left outer JOIN City
ON City.City Like '%' + Article.Description + '%' WHERE Article.IndexGUID='f50c528b-230f-4732-b3a9-138c7af039c2' AND
Article.Date BETWEEN '1/1/2012' AND '3/1/2012' AND Article.Title LIKE '%computer%' 
ORDER BY Article.Date DESC

Open in new window

0
 

Author Closing Comment

by:MaxKroy
Comment Utility
Thanks.
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Join & Write a Comment

Suggested Solutions

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

744 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now