Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 11-26-2009, 04:33 PM Sql select
Super Talker

Posts: 128
Name: Jose daSilva
Trades: 0
Hi

How can I make a select from query to obtain results of two different values in the same column?

thanks
josil is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 11-26-2009, 04:35 PM Re: Sql select
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
use OR or AND in the WHERE criteria
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 11-26-2009, 04:36 PM Re: Sql select
lynxus's Avatar
Awesomeo-Maximo

Posts: 1,618
Location: UK
Trades: 1
?
Do you mean take 2 different values from the same column result?

or take 2 different columns and put them together?

Im a little cunfuzzed ? or maybe to drunk.
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


lynxus is offline
Reply With Quote
View Public Profile Visit lynxus's homepage!
 
Old 11-26-2009, 04:55 PM Re: Sql select
Super Talker

Posts: 128
Name: Jose daSilva
Trades: 0
Quote:
Originally Posted by lynxus View Post
?
Do you mean take 2 different values from the same column result?

or take 2 different columns and put them together?

Im a little cunfuzzed ? or maybe to drunk.
lol

I did:

$sql="SELECT * FROM wallet WHERE imagem!=0 and country IN (Usa,Canada) limit 4";

$sql="SELECT * FROM wallet WHERE imagem!=0 and country='(Usa,Canada)' limit 4";


But does not work
josil is offline
Reply With Quote
View Public Profile
 
Old 11-26-2009, 04:58 PM Re: Sql select
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
IN ('USA','Canada')
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 11-26-2009, 05:01 PM Re: Sql select
Novice Talker

Posts: 11
Trades: 0
SELECT column1, column2 FROM tablename WHERE recordid=(value you are looking for)

Hope thats what you are looking for or should I say be more specific please.
__________________
Wondering who Iam? Visit me and check my thoughts at
Please login or register to view this content. Registration is FREE

Want to earn cash? click the image below :
Please login or register to view this content. Registration is FREE

chieina is offline
Reply With Quote
View Public Profile
 
Old 11-26-2009, 05:10 PM Re: Sql select
Super Talker

Posts: 128
Name: Jose daSilva
Trades: 0
Quote:
Originally Posted by chrishirst View Post
IN ('USA','Canada')
It is working. Thanks

But another question:

can I use:

sql * from table where image!=0 and country IN('Usa','Canada') and IN city('NY',Toronto') limit 4 (/code) in the same query?
josil is offline
Reply With Quote
View Public Profile
 
Old 11-26-2009, 05:51 PM Re: Sql select
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
You can, though NOT using SELECT * would be MUCH better and correcting the syntax on "and city IN('NY',Toronto') ...
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 11-26-2009, 08:04 PM Re: Sql select - Problem SOLVED
Super Talker

Posts: 128
Name: Jose daSilva
Trades: 0
Quote:
Originally Posted by chrishirst View Post
You can, though NOT using SELECT * would be MUCH better and correcting the syntax on "and city IN('NY',Toronto') ...

Ok. Thank you very much for the help.

be good!!!
josil is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Sql select
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.58395 seconds with 12 queries