I'm have 5 tables.
First products like:
id | country_ids | category_ids | users_ids
1 | 1,4,6 | 4,5,6,70 | 5,6,9
2 | 5,6,3 | 4,8,2,11 | 1,5,8
Second countries like:
c_id | c_name
1 | Åland Islands
2 | Antarctica
...
Third categories like:
cat_id | cat_name
2 | Small
4 | Large
....
Hello ALL,
I have following table structure
table_country ==> country_id (PK) | country | status
table_department ==> department_id (PK) | department | country_id (FK)
table_province ==> province_id (PK) | province | department_id (FK)
table_district ==> district_id (PK) | district | province_id (FK)
NOTE: all tables engine are inn...
I have a content types with 3 file fields, all of them can have an unlimited number of images. I need to make a view that returns the title of the content and the images name inside an array (I'm using amfphp with services). The problem is that when I add the relationship to the content field_pics fid I get as many duplicate nodes as th...
I have a table with columns:
JOB_NUM, HM_PH, BUS_PH, CALL1ST
Where the job_num is a unique number
And the HM_PH, BUS_PH, and CALL1ST columns are 10 digit phone numbers
So using the order of columns above, sample data would look like:
JOB_NUM, HM_PH, BUS_PH, CALL1ST
------------------------------------
12345, 4025557848, ...
I have 3 models defined:
Palette (has many swatches)
Swatch (has one color)
Color (?)
How should the tables / associations be defined so that from the Palette object you can collect all the colors, for example:
@colors = @palette.swatches.colors
(Swatches currently store a color_id, palette_id, plus some related info such as sort_...
Just wondering if anyone has any tricks (or tools) they use to visualize joins. You know, you write the perfect query, hit run, and after it's been running for 20 minutes, you realize you've probably created a cartesian join.
I sometimes have difficulty visualizing what's going to happen when I add another join statement and wondered i...
Given the following tables:
labels tags_labels
|id |name | |url |labelid |
|-----|-------| |/a/b |1 |
|1 |punk | |/a/c |2 |
|2 |ska | |/a/b |3 |
|3 |stuff | |/a/z |4 |
artists tags
|id |name | |url |artistid |albumid ...
I have a simple hierarchy of categories in an SQLite3 database, each row storing a parent ID or NULL as appropriate.
I would like to find out whether a particular category is a leaf, essentially by determining, for each row, whether it has a parent ID defined. Or rather, determining a count of child rows for each row.
Table definiti...
I am having trouble with the query in this code. The problem is one I have had before, the $num = mysql_num_rows($result); part gives me a MySQL error saying it expected a resource. Usually when I have this error it is because I misplaced a single quote some where, but after looking I cannot find any problem, though this query is a bit...
How can I get all students names that were taught by the teacher with name John?
student
id
name
student_has_teacher
teacher_id
student_id
teacher
id
name
...
Hi, I have 2 columns in an "entries" table: a non-unique id, and a date stamp (YYYY-MM-DD). I want to select "all of the entry id's that were inserted today that have never been entered before."
I've been trying to use a subquery, but I don't think I'm using it right since they're both performed on the same table. Could someone help me ...
Hi there,
I can use
select * from sent_txts s
LEFT JOIN received_txts r ON s.msg_link_id = r.id
WHERE r.action_id = 6;
top select matching rows,
how can i write a query to delete the matching rows on both sides?
something like
delete sent_txts s
LEFT JOIN received_txts r ON s.msg_link_id = r.id
WHERE r.action_id = 6;
cheers....
How to perform left outer join in C# LINQ to objects without using join-on-equals-into clauses? Is there any way to do that with where clause?
Correct problem:
For inner join is easy and I have a solution like this
List< JoinPair> innerFinal = (from l in lefts from r in rights where l.Key == r.Key
select new JoinPair { LeftId = l.Id,...
I alway wondered how could a very big site like facebook to be faster than any other sites ,though the very big large amount of data which stored everyday ..
what they are using to store information and if I use sql server to store e.g news feed is that ok or what (the news feed will be stored in a separate table which called News) . ...
Hi there,
I'm trying to perform a select query over two tables, one containing, for example, products, and the other containing the colors that can be chosen for those products.
Each product has a different number of colors that can be chosen; some have only one color, others can have 20 of them.
The scope of the query is to parse a l...
Hi. I got:
entity1 - ID, OwnerCode
entity2 - OwnerCode, DepartmentCode
Also I have some DepartmentCode
Now i want get something like this(sql syntax):
Select e1.ID
from entity1 e1
join entity2 e2 on e1.OwnerCode = e2.OwnerCode and e2.DepartmentCode=7
via Linq
I wrote:
var q = from e1 in entityes1
join e2 in entit...
Hi,
I'm setting up a small system that keeps track of which person is assigned to a request.
My table structure looks like this:
Table: requests
RequestID
RequestDetails
Table:request_staff
RequestID
StaffUserID
Obviously RequestID is used to link to the two tables.
I want to select all requests for a staff member. My underst...
Say I have four tables, users, contacts, files, and userfiles.
Users can upload files and have contacts. They can choose to share their uploaded files with their contacts.
When a user selects one or more of their uploaded files, I want to show a list of their contacts that they are not already sharing all of their selected files with. ...
Hi, I have a problem with mysql
I have 3 tables:
Deposit
+-------------------+-------------+------+-----+
| Field | Type | Null | Key |
+-------------------+-------------+------+-----+
| id | bigint(20) | NO | PRI |
| status | int(2) | NO | |
| depositDate | datetime |...
Is it possible to do cross database joins in drupal?
Say you have two databases, drupal and old_data_source. You want to join drupal.node to old_data_source.page.
db_set_active() can be called to use multiple databases. However can't find anything about cross database table joins!
(I'm looking into this as part of a migration script a...