CrazyEngineers Forum

Turn The Screws!

Open your eyes, look in front, look at the back, look at any angle and you will see something that is an engineer's creation.

Engineers have been making things possible that others could only imagine. It perfectly makes sense to have a common place for engineers from around the world where they can share ideas, innovate, & help each other. Engineers are eternal, with the younger at 62 & the youngest at 17, the CEan gang consists of working professionals, students, entrepreneurs, CEOs, professors, geeks & nerds.

Need we say more? Click Here To Join The Gang!
Navigation
Go Back   CrazyEngineers Forum > CE : Technical Discussions > Computer Science & IT Engineering
Reply

  #1 (permalink)
Old 3rd July 2008, 01:29 AM
hbk
CE - Apprentice
 
I'm a Crazy Computers Engineer
Join Date: 12th June 2008
Posts: 36
Default Data slection based on multiple conditions

hi frnds.

this is something which may seem foolish to ask, but i have been beating my head against the wall at the frustration of not being able to get over this...

anyways, what i want to do is to select some data from a single MySQl table, using a WHERE clause on multiple columns

eg. SELECT * from TABLENAME where COLUMN1 = VALUE1, COLUMN2 = VALUE2, COLUMN3 = VALUE3 ....

I have tried using (),AND as well as comma between the different conditions, but they all give an error.

please help...

cheers...
__________________
2 ways to happines--->

1. Accept what you cannot change
2, Change what you cannot accept
hbk is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored links
  #2 (permalink)
Old 28th July 2008, 05:05 PM
CE - Apprentice
 
yudi's Avatar
 
I'm a Crazy Information Technology Engineer
Join Date: 24th July 2008
Posts: 35
Default Re: data slection basd on multiple conditions

try using OR operator coz as per my knowledge
different conditions in where clause are seperated by OR operator......
__________________
Yudi
yudi is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)
Old 28th July 2008, 07:50 PM
CE - Newbie
 
esakiraja's Avatar
 
I'm a Crazy Computer Tech Engineer
Join Date: 28th July 2008
Location: Hyderabad
Posts: 7
Default Re: Data slection based on multiple conditions

Think this below eg will help u...

Eg: select * from tablename where primarykey(column) = 'value'
and column2 = 'value'
and column3 = 'value'
esakiraja is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)
Old 2nd August 2008, 12:43 PM
CE - Apprentice
 
Itanium's Avatar
 
I'm a Crazy Comp Sci Engineer
Join Date: 2nd August 2008
Posts: 27
Default Re: Data slection based on multiple conditions

select * from table
where col1 = 'value1' and
col2 = 'value2' and
col3 = 'value3';

this should be the query if all the columns are holding string data.
If any column is holding numeric data, then you dont need to specify the value within quotes.

Can you post your exact code for us to analyse ?
Itanium is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored links
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

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



All times are GMT +5.5. The time now is 06:45 PM.
Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Member comments are owned by the poster. Copyright © 2005-2008 CrazyEngineers.com. All rights reserved.Ad Management by RedTyger