?
Solved

sql statement not correct in mysql  may be come form select

Posted on 2008-01-30
3
Medium Priority
?
198 Views
Last Modified: 2010-03-20
Select  Round(DATEDIFF( NOW() ,'balanceborow.DateBalance')/30, 0) As MonthNos


SELECT balanceborow.wid, balanceborow.wname, balanceborow.amout,  CEILING(balanceborow.amout*.02) AS Interrest, balanceborow.DateBalance, balanceborow.amout,Select  Round(DATEDIFF( NOW() ,'balanceborow.DateBalance')/30, 0) As MonthNos
FROM balanceborow
WHERE balanceborow.wid =' $AccNo'
0
Comment
Question by:teera
3 Comments
 
LVL 23

Accepted Solution

by:
Ashish Patel earned 1000 total points
ID: 20776014
Now use this.

SELECT balanceborow.wid, balanceborow.wname, balanceborow.amout,  CEILING(balanceborow.amout*.02) AS Interrest, balanceborow.DateBalance, balanceborow.amout, Round(DATEDIFF( NOW() , balanceborow.DateBalance)/30, 0) As MonthNos
FROM balanceborow
WHERE balanceborow.wid =' $AccNo'
0
 
LVL 7

Assisted Solution

by:bradleys40
bradleys40 earned 400 total points
ID: 20776018
you  have an extra select in

Select  Round(DATEDIFF( NOW() ,'balanceborow.DateBalance')/30, 0) As MonthNos

should be
SELECT balanceborow.wid, balanceborow.wname, balanceborow.amout,  CEILING(balanceborow.amout*.02) AS Interrest, balanceborow.DateBalance, balanceborow.amout, Round(DATEDIFF( NOW() ,'balanceborow.DateBalance')/30, 0) As MonthNos
FROM balanceborow
WHERE balanceborow.wid =' $AccNo'
0
 
LVL 10

Assisted Solution

by:Nellios
Nellios earned 400 total points
ID: 20776021
I'm not sure what your are trying to do, but your syntax is incorrect.

The error is that you have two selects in one statement, one of which is incomplete.
you need to:

SELECT
balanceborow.wid,
balanceborow.wname,
balanceborow.amout,
CEILING(balanceborow.amout*.02) AS Interrest,
balanceborow.DateBalance,
balanceborow.amout,
Round(DATEDIFF( NOW() ,'balanceborow.DateBalance')/30, 0) As MonthNos
FROM balanceborow
WHERE balanceborow.wid =' $AccNo'

Good luck
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
In this article, we will show how to detach and attach a database and then show how to repair a corrupt database and attach it, If it has some errors. We will show how to detach and attach using SSMS or using T-SQL sentences.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

594 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