View previous topic :: View next topic |
Author |
Message |
Xildjian
Joined: 08 Jan 2005 Posts: 100
|
Posted: Sun Jul 31, 2005 19:02 Post subject: Database query help... |
|
|
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 |
|
|
teleri
Joined: 28 Jan 2005 Posts: 21
|
Posted: Mon Aug 01, 2005 2:37 Post subject: |
|
|
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 |
|
|
dms
Joined: 15 Jun 2005 Posts: 3
|
Posted: Thu Aug 04, 2005 14:52 Post subject: |
|
|
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 |
|
|
Xildjian
Joined: 08 Jan 2005 Posts: 100
|
Posted: Mon Aug 08, 2005 13:07 Post subject: |
|
|
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 |
|
|
|
|
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
|