Trying to merge some data that I have. The input would look like so:
foo bar
foo baz boo
abc def
abc ghi
And I would like the output to look like:
foo bar baz boo
abc def ghi
I have some ideas using some arrays in a shell script, but I was looking for a more elegant or quicker solution.
...
I want to make it so that anytime the db is queried for an sfGuardUserProfile it is autmoatically joined and hydrated with its related sfGuardUser.
If i was using Propel 1.2 i would normally override the doSelectStmt method of the sfGuardUserProfilePeer class to inspect the Criteria and modify it as necessary as well as modifying the hy...
Where's the problem in my code ?
string constr = "Provider=Microsoft.Jet.OLEDB.4.0;"
+ "Data Source=C:\\Users\\Simon\\Desktop\\test5\\test5\\test5\\save.mdb";
OleDbConnection conn = new OleDbConnection(constr);
string sql = "SELECT users.user_name,naziv,obroki_save.datum"
+ "FROM zivila JOIN obroki_save ON zivila.ID=obroki_save.ID_...
I'm looking to create a Left outer join Nhibernate query with multiple on statements akin to this:
SELECT * FROM [Database].[dbo].[Posts] p LEFT JOIN [Database].[dbo].[PostInteractions] i
ON p.PostId = i.PostID_TargetPost And i.UserID_ActingUser = 202
I've been fooling around with the critera and aliases, but I haven't had a...
I was reading this Sun's tutorial on Thread.
I found a block of code there which I think can be replaced by a code of fewer lines. I wonder why Sun's expert programmers followed that long way when the task can be accomplished with a code of fewer lines.
I am asking this question so as to know that if I am missing something that the tut...
Hi,
I just built a website and have realised that I need to have a top 3 highest rated albums.. I haven't built in something that keeps track of the ratings. Ratings are stored separately. Can someone show me how to put these together please.
SELECT id, name FROM albums LIMIT 3
SELECT rating FROM ratings WHERE url=CONCAT('albums/show/...
Morning y'all!
Basically, I'm using a table to store my main data - called 'Code' - a table called 'Tags' to store the tags for each code entry, and a table called 'code_tags' to intersect it.
There's also a table called 'users' which stores information about the users who submitted each bit of code.
On my homepage, I want 5 results r...
I have two tables that I need to join... I want to join table1 and table2 on 'id' - however in table two id is not unique. I only want one value returned for table two, and this value represents the sum of a column called 'total_sold' - within a specified date range (say one month), however I want more than one date range at the same tim...
I'm trying to join the NAME and PHOTO from USERS table to the TRANSACTIONS table based on who is the payer or payee. It keeps telling me can't find the table this -- What am I doing wrong?
SELECT `name`,`photo`,`amount`,`comment`,
(
CASE `payer_id`
WHEN 72823 THEN `payee_id`
ELSE `payer_id`
END
) AS `this`
FROM `transact...
Hi
I have the following SQL SELECT statement
SELECT bar_id, bar_name, town_name, advert_text
FROM bar, towns, baradverts
WHERE town_id = town_id_fk
AND bar_id = bar_id_fk
My problem is that since not every bar has an advert in table "baradverts", these bars are not coming up in the results. In other words I need a NULL for those...
Hi,
I want to get some results via query simillar to:
SELECT
* FROM
users LEFT JOIN
IF (users.type = '1', 'private','company') AS details ON
users.id = details.user_id WHERE
users.id = 1
Any ideas?
...
I want to transfer the following statement to SubSonic 2.2
SELECT b.*
FROM tableA a
INNER JOIN tableB b
ON (a.year = b.year AND a.month = b.monath AND a.userid = b.userid);
My problem is that SubSonic's SqlQuery.LeftInnerJoin() command has no overload which takes more than one column.
Since any join can be rewri...
Hi folks. I've been beating my head against the wall on something that on the surface should be very simple. Lets say I have the following simplified models:
user.rb
has_many :memberships
has_many :groups, :through => :memberships
membership.rb
belongs_to :group
belongs_to :user
STATUS_CODES = {:admin => 1, :member => 2, :invi...
I've been trying to use the IsNull() function to ensure that there is a value for a field.
$result = mysql_query("
SELECT crawled.id,IsNull(sranking.score,0) as Score,crawled.url,crawled.title,crawled.blurb
FROM crawled
LEFT JOIN sranking ON crawled.id = sranking.sid
WHERE crawled.body LIKE '%".$term."%'
ORDER BY Score DESC LIMIT " ...
Hi,
I have 2 entities: Customer & Account, where a customer can have multiple accounts.
On the account, I have a "PlatformTypeId" field, which I need to condition on (multiple values), among other criterions.
I'm using Lambda expressions, to build the query. Here's a snippet:
var customerQuery =
from c in context.CustomerSet.Includ...
Hi,
I am tying to join the following 2 queries but I am having duplicated .... it is possible to remove duplacted fro this:
(
SELECT bar_id, bar_name, town_name, bar_telephone,
(subscription_type_id *2) AS subscription_type_id
FROM bar, sportactivitybar, towns, subscriptiontype
WHERE sport_activity_id_fk =14
AND bar_id = b...
I have three tables that I need to join together and get a combination of results. I have tried using left/right joins but they don't give the desired results.
For example:
Table 1 - STAFF
id name
1 John
2 Fred
Table 2 - STAFFMOBILERIGHTS
id staffid mobilerightsid rights
--this table is empty--
Tabl...
I have a scenario which I'm a bit stuck on. Let's say I have a survey about colors, and I have one table for the color data, and another for people's answers.
tbColors
color_code , color_name
1 , 'blue'
2 , 'green'
3 , 'yellow'
4 , 'red'
tbAnswers
answer_id , favorite_color , least_favorite_...
Hi,
I have the following query which returns 2 tuples
SELECT bar_id, bar_name, town_name, bar_telephone, subscription_type_id, pic_type
FROM towns, subscriptiontype, regions, bar
LEFT JOIN barpictures bp ON bar.bar_id = bp.bar_id_fk
WHERE town_id = town_id_fk
AND bar.test_field = 0
AND subscription_type_id = subscription_type_id_fk
AND...
I know this very silly, but can anybody help me in understanding what does this join query is doing in elabortive description?
SELECT j1.*
FROM jos_audittrail j1
LEFT OUTER JOIN jos_audittrail j2
ON (j1.trackid = j2.trackid AND j1.field = j2.field AND j1.changedone < j2.changedone)
WHERE j1.operation = 'UPDATE'
AND j1.trackid=$t_id...