Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2006
    Posts
    1

    Unanswered: return everything in the table EXCEPT for the name (was "Complex Query")

    I have the following table, and I need help with some queries

    Table Name: Story
    Table Columns: user_id, date, name, yr_left, city_origin, country_origin, yr_arrival, city_arrival, state_arrival, address, city, state, zip, AorV (audio or video), filename, approved

    I need to create two queries. One based on date in descending order, and one based on country_origin in alphabetical order. For both of these queries, the approved field has to = Y for yes, and when I return results I need it to return everything in the table EXCEPT for the name.

    I'm a beginner at SQL queries so I was hoping someone could shed some light and help me??? Thanks a bunch!

  2. #2
    Join Date
    Apr 2006
    Location
    Denver, Co. USA
    Posts
    242
    Unfortunately, there is no SELECT * EXCEPT... syntax (that I am aware of or could find.) Since you have many columns, you must either list the ones you want or get all of them and ignore/skip over the ones you don't want.

    Your queries would look like this -

    SELECT user_id, date, yr_left, city_origin, country_origin, yr_arrival, city_arrival, state_arrival, address, city, state, zip, AorV, filename, approved FROM story WHERE approved='y' ORDER BY date DESC

    SELECT user_id, date, yr_left, city_origin, country_origin, yr_arrival, city_arrival, state_arrival, address, city, state, zip, AorV, filename, approved FROM story WHERE approved='y' ORDER BY country_origin

Posting Permissions

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