Ask a Question related to Coldfusion Database Access, Design and Development.
-
Conti #1
Usage of the " IN " operator
Permits contains a string: 4,16,12,9,12,7,5 .....
cookie.userid is a number
<cfquery name="rsTitols" datasource="gallery">
SELECT * FROM Galleries
WHERE '#cookie.userid#' in(SELECT permits from Galleries)
</cfquery>
does not produce an error but doesn't return any value.
Should value in "permits" be quote delimited with ListQualify()?
How do I do that?
Thank you very much.
Conti Guest
-
#39018 [NEW]: Error control operator '@' fails to suppress "Uninitialized string offset"
From: mpb dot mail at gmail dot com Operating system: Gentoo Linux PHP version: 5.1.6 PHP Bug Type: Scripting Engine problem... -
vb.net: Problem using "IS" operator with ? parameter in Dataset
I'm sure someone's come across this, but I couldn't find it searching the boards. I get the error message "Invalid use of Is operator in query... -
offending operator "nary"
Upon opening a file for a catalog I am working on an error came on the screen. It said: offending operator "nary" Content: XH %AI5_End Raster... -
#26122 [Opn->Bgs]: Logical Operator "and" not functioning as expected
ID: 26122 Updated by: iliaa@php.net Reported By: iam at nimajneb dot com -Status: Open +Status: ... -
#26122 [NEW]: Logical Operator "and" not functioning as expected
From: iam at nimajneb dot com Operating system: Mac OSX 10.2.6 PHP version: 4.3.2 PHP Bug Type: Math related Bug... -
paross1 #2
Re: Usage of the " IN " operator
Very bad data model/design. Is there any way that you could avoid having a comma delimited list in the permits field?
Phil
paross1 Guest
-
Conti #3
Re: Usage of the " IN " operator
You are right Phil. The newbie here.
At creation, I need to relate a record in table Galleries to a certain number
of users in table Users.
Basics I suppose. Could you give me an hint.
Thnak you very much.
Wal
Conti Guest
-
paross1 #4
Re: Usage of the " IN " operator
So I am assuming that there is a many-to-many relationship between Galleries
and users. (More than one user can be associated with more than one gallery,
and vice versa.) You should create a "link" table (associative entity) that
contains, at a minimum, the PK field of the Galleries table and the PK field of
the users table (I am assuming that Galleries has a primary key). Call this
GalleryUsers. Then for every case where you have a user associated to a
gallery, you would insert a row with the userID and galleryID. Then you could
join Galleries, Users, and GalleryUsers in a query to select users associated
with a gallery, or galleries associated with a particular user, or all
galleries and users, etc.
For example, something like this would allow you to list the galleries that
are associated with a particuar user:
SELECT g.gallery_name
FROM users u, Galleries g, GalleryUsers gu
WHERE gu.galleryID = g.galleryID
AND gu.userID = u.userID
AND u.user_name = '#UserName#'
Phil
paross1 Guest



Reply With Quote

