CrazyEngineers Forum

******************************************
Welcome To CrazyEngineers (CE) – an online community of engineers from all over the world! With the younger CEan at 84 and the youngest at 16, CE boasts of professional engineers, students, professors, entrepreneurs, CEOs, geeks & nerds. We exchange innovative ideas, share knowledge, help each other and expand our worldwide network of engineers! You need not have a formal degree in engineering to be a part of CrazyEngineers! Need we say more?
Join CE! | Be a CE Ambassador! | Forgot password? | Sponsor CE | Contact Us
Navigation
Go Back   CrazyEngineers Forum > CE : Technical Discussions > Computer Science & IT Engineering
Reply

  #1 (permalink)
Old 3rd July 2008, 02: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, 06:05 PM
CE - Apprentice
 
yudi's Avatar
 
I'm a Crazy Information Technology Engineer
Join Date: 24th July 2008
Posts: 36
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, 08:50 PM
CE - Apprentice
 
esakiraja's Avatar
 
I'm a Crazy Computer Tech Engineer
Join Date: 28th July 2008
Location: Hyderabad
Posts: 11
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, 01: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 10:06 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