If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > return everything in the table EXCEPT for the name (was "Complex Query")

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-10-06, 13:54
Jennifer_Ann Jennifer_Ann is offline
Registered User
 
Join Date: Apr 2006
Posts: 1
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!
Reply With Quote
  #2 (permalink)  
Old 04-10-06, 19:44
dbmab dbmab is offline
Registered User
 
Join Date: Apr 2006
Location: Denver, Co. USA
Posts: 240
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On