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

    Join Date
    Feb 2003
    Posts
    38
    Rep Power
    12

    Question General direction to look?


    How do I used SQL how do I do the compare logic for a request like this?

    Select some stuff from 2 differant tables
    If table1.Status == 1 list the stuff from some other tables
    If table2. Status ==1 list the stuff from table 1

    What is this kind of stuff called in SQL? Can I do this sortof logic in a stored procedure? or my usual C++/ODBC?

    Thanks in advance.
  2. #2
  3. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,280
    Rep Power
    4279
    this stuff -- that's a good one

    check this out -- sql tutorial

    rudy
    http://r937.com/
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    38
    Rep Power
    12
    I don't see how to do the

    IF
    Then Clause in SQL
  6. #4
  7. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,280
    Rep Power
    4279
    you want CASE for that

    select case when sex='1' then 'male' else 'female' end

IMN logo majestic logo threadwatch logo seochat tools logo