| | |
Question about SELECT statement
Please support our MS SQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jun 2005
Posts: 92
Reputation:
Solved Threads: 0
I have one table in this format:
now I want to display product which components meet requested items, for example:
I know component are "part1" and "part3", need to show product name (that is "A").
How can I do that in SQL statement?
Thanks.
Product Component --------------------------- A part1 A part2 B part1 B part4 A part3 C part5 D part1
now I want to display product which components meet requested items, for example:
I know component are "part1" and "part3", need to show product name (that is "A").
How can I do that in SQL statement?
Thanks.
SQL Syntax (Toggle Plain Text)
SELECT Product FROM Table WHERE Component IN ('part1','part3')
Last edited by cgyrob; Jul 16th, 2009 at 6:53 pm.
cgyrob's response was what you asked for. What is your real goal here? Or are we not understanding your problem correctly?
If you really want an 'AND' use an 'AND'
SQL Syntax (Toggle Plain Text)
SELECT Product FROM Table WHERE Component = 'part1' AND Component ='part3'
![]() |
Similar Threads
- Question about SELECT statement (MS SQL)
- Question about select statement (MySQL)
- Question about SELECT statement (MySQL)
- Question about SELECT statement. (MySQL)
- Getting current value in Select Statement (MS SQL)
- Program Problem with a select statement to access Data base (C)
Other Threads in the MS SQL Forum
- Previous Thread: How to open Master Database File(.mdf)
- Next Thread: Aspx page wont search a database
Views: 405 | Replies: 4
| Thread Tools | Search this Thread |
Tag cloud for MS SQL
"last age autogrowth business connectingtodatabaseinuse count cursor data database dateadd datediff datepart day" dbsize deadlock delete_trigger exploit getdate hack highperformancecomputing hpc hpcserver2008 ibm iis limit live loop maximum microsoft ms mssql multiple multithreading news number password permission position query reporting result security server services sets single source sql sql-injection sqlserver sqlserver2005 subtype supercomputing supertype tables uniqueid update view weekday






