Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2005
    Posts
    71

    Unanswered: How can i set a new columns value in a select...

    based upon another column in the table.

    Table: Names
    Columns: N_RID char(10)
    N_Type byte
    N_Last char(50)
    N_First char(25)

    i want to be able to select name column as follows
    if N_Type = 0 then
    Name = N_Last
    else
    Name = N_Last + ', ' + N_First

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Hi hicpics

    I notice you cross posted in the SQL Server forum. Is this T-SQL or Access SQL? If the former - then stick with CASE. If the latter then have a look at Iif or you can try SWITCH

    HTH
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Mar 2005
    Posts
    71

    Originally it was a Access Question I hadnt looked...

    into this forum very much to see the access section. so when i tried using the CASE statement and found it didnt work. i was going to come back to the SQL post and ask about Access equivalent of CASE statement but that is when i found this post. Anyways sorry for the double post and i will now take a look at IIF & SWITCH
    thanks again...

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    No probs. I actually thought this was more likely the error post cause your data types are correct in SQL Server but not above. But then I am picky
    Testimonial:
    pootle flump
    ur codings are working excelent.

  5. #5
    Join Date
    Mar 2005
    Posts
    71

    Got it to work with the IIf

    FYI: I have been using the MSSQL and Delphi in all past projects, Now for some reason a user of mine wants to use an Access file. So now i am trying to learn some basics about it. I only know the basics of MSSQL. Mostly use a query builder but even my knowledge of that is kind of limited.
    SO thanks for the help again...

  6. #6
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    In that case - some handy links:

    http://msdn.microsoft.com/library/de.../acfundsql.asp
    http://msdn.microsoft.com/library/de...l/acintsql.asp
    http://msdn.microsoft.com/library/de...l/acadvsql.asp

    Hmmm - just checked my "differences between Access SQL and T-SQL" link and it seems a bit out of date. I will see if I can find another....
    Testimonial:
    pootle flump
    ur codings are working excelent.

Posting Permissions

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