#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Posts
    3
    Rep Power
    0

    SQL Syntax Problem


    I'm new in firebird

    I'm having a problem to execute the below sql statement in firebird

    Select *,(Select Itm_Code from Item where Item.Itm_ID =
    Company.DefaultServiceCode)as ServiceCode from Company

    it show that * is not allow on the above statement, can anyone help me on
    this
    thanx
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Posts
    250
    Rep Power
    14
    List single columns of "company" then.
    Martijn Tonies
    Database Workbench: developer IDE for Firebird, MySQL, InterBase, MSSQL Server and Oracle
    Upscene Productions
    http://www.upscene.com
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Posts
    3
    Rep Power
    0
    I have more than 70 Column in company table, that is a long sql statement if i put all the column in my sql statement, is there any way to solve this problem??

    it work fine in MS SQL and MS Access
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Posts
    250
    Rep Power
    14
    Then use:
    Select company.*

    Nevertheless, it's not good practice to use "*".
    Martijn Tonies
    Database Workbench: developer IDE for Firebird, MySQL, InterBase, MSSQL Server and Oracle
    Upscene Productions
    http://www.upscene.com
  8. #5
  9. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,235
    Rep Power
    4279
    try this instead:
    Code:
    Select Company.*
         , Item.Itm_Code
      from Company
    left outer
      join Item 
        on Company.DefaultServiceCode
         = Item.Itm_ID
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Posts
    3
    Rep Power
    0
    thanx i have solve the problem...

    so it mean sub query will slower than left outer
    join ??
  12. #7
  13. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,235
    Rep Power
    4279
    no, they should be the same
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

IMN logo majestic logo threadwatch logo seochat tools logo