Results 1 to 4 of 4

Thread: Simple sql ?

  1. #1
    Join Date
    Oct 2003
    Posts
    311

    Unanswered: Simple sql ?

    incorrect syntax near #
    how do i fix this and did i make any other errors?


    SELECT Master.CheckNum, Master.CheckDate, Master.ExpenseType, Deal.Alias, Detail.InvoiceDate, Detail.InvoiceAmount, Detail.Person, Detail.Deal, Detail.InvoiceNum, Detail.Reference, Detail.idDetial
    FROM Master INNER JOIN (Deal INNER JOIN Detail ON Deal.Deal = Detail.Deal) ON Master.CheckNum = Detail.CheckNum
    WHERE (((Master.CheckDate)>#12/5/2005#) AND ((Deal.Alias)="aic"));

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    MS Access uses the # sign to denote date values. SQL Server does not. Just use single quotes instead, as SQL Server implicitly converts date strings to date values.
    Also, use single quotes instead of double quotes around 'aic'.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  3. #3
    Join Date
    Oct 2003
    Posts
    311
    Thanks!~ Its been a long time since i have touched sql server, i have a funny feeling i will be posting allot!

  4. #4
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Try this cleaned-up code:
    Code:
    SELECT	Master.CheckNum,
    	Master.CheckDate,
    	Master.ExpenseType,
    	Deal.Alias,
    	Detail.InvoiceDate,
    	Detail.InvoiceAmount,
    	Detail.Person,
    	Detail.Deal,
    	Detail.InvoiceNum,
    	Detail.Reference,
    	Detail.idDetial
    FROM	Master
    	INNER JOIN Detail on Master.CheckNum = Detail.CheckNum
    	INNER JOIN Deal on Detail.Deal = Deal.Deal
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •