I have a table of book authors, and am trying to get a query result of books by a certain author.
Something like
SELECT * FROM mytable WHERE authors = Carl Sagan
I need all of the columns for each row that matches.
Any help would be appreciated, I'm new to SQL.
Thanks!
Just to clarify, Assumptions: 1.) Carl Sagan authored more than one item in this table. 2.) You want to return all of the occurrences of Carl Sagan.
Original: SELECT * FROM mytable WHERE authors = Carl Sagan
Should Be: SELECT * FROM mytable WHERE authors = 'Carl Sagan'
FYI, I use HeidiSQL to test queries. Let me know if that helps.
You have the query correct except that you need to have the text you're comparing to delimited as a string:
SELECT * FROM mytable WHERE authors='Carl Sagan'
Your question seems unclear to me, but modify your query by putting a single quote
SELECT * FROM mytable WHERE authors = 'Carl Sagan'