logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Database query help...

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Database related
View previous topic :: View next topic  
Author Message
Xildjian



Joined: 08 Jan 2005
Posts: 100

PostPosted: Sun Jul 31, 2005 19:02    Post subject: Database query help... Reply with quote

Does anyone know how to make this type of query?

Say I have a table define as follows:

col1 col2 col3 col4
.......................................
tag | item1 | item2 | item3

I want to query the table with val1, val2, val3, but I don't care which column (2-4) val1 val2 or val3 is located in. Just as long as all the values live in that row.

I would appreciate any help, thanks!
_________________
Member Shadow of Iniquity development team
Back to top
View user's profile Send private message
teleri



Joined: 28 Jan 2005
Posts: 21

PostPosted: Mon Aug 01, 2005 2:37    Post subject: Reply with quote

to learn how to use MySQL I would reccomend the book "MySQL Weekend Crash course" ISBN Number 0-7645-3634-6 not an advanced boot but for $20 american it is one of the best books for learing what you need in MySql.
Back to top
View user's profile Send private message
dms



Joined: 15 Jun 2005
Posts: 3

PostPosted: Thu Aug 04, 2005 14:52    Post subject: Reply with quote

I guess there's always more than one way of doing things... how about

select MyColumn from MyTable where Field('item1',col2,col3,col4) > 0 and Field('item2',col2,col3,col4) > 0 and Field('item3',col2,col3,col4) > 0;

That will return any row which contains item1, item2 and item3 and where they are stored is irrelevent.
Back to top
View user's profile Send private message
Xildjian



Joined: 08 Jan 2005
Posts: 100

PostPosted: Mon Aug 08, 2005 13:07    Post subject: Reply with quote

dms wrote:
select MyColumn from MyTable where Field('item1',col2,col3,col4) > 0 and Field('item2',col2,col3,col4) > 0 and Field('item3',col2,col3,col4) > 0;


Sweet thanks, this does exactly what I wanted.

Thanks again!
_________________
Member Shadow of Iniquity development team
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Database related All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group