Hi Im having a hardtime making my query work the way it should be.i'm getting wrong output. basically what im trying to do is a simple user statistic that will show the user inputed data and user processed data base on the date range the user selected. heres the screenshots for better visualization ![1.jpg](/attachments/large/3/5d026cec4cbfe61d5bb47291bbbda47f.jpg "align-center") and the query for that is. first Get all the user from the user table `Select Name from user GROUP BY Name ORDER BY Name ASC` then i will loop inside the reservations table for the matching username base on the date range selected select …

Member Avatar
Member Avatar
+0 forum 6

Hi everyone i need some help down here. i am trying to connect multiple db and at the same time i want to sum the value of the column. what i have right now is this SELECT SUM(total) as branch1sales FROM icm.sales UNION SELECT sum(total) as branch2sales FROM hism.sales its computing correctly but the problem is the branch2 alias is being invoke. what am i doing wrong? see attached image for the output ![Untitled.jpg](/attachments/small/3/2380191a296b9b064ffa52c969a268a3.jpg "align-left") thanks

Member Avatar
Member Avatar
+0 forum 2

Is there a way to get a total counts from the resultset of two unions? This will be for DB2. select count(*) from ( select count(*) from xyz where abc='1' union all select count(*) from x1y1z1 where abc='1' )

Member Avatar
Member Avatar
+0 forum 2

Hi need some insight on how to show record from different database on the same server. i also tried using join but didnt get the correct output. im finding a way to make it work using just one query. my last resort will be using different query to select the data i need(hope i wouldn't go that way) what i have so far is this. it show the record of both database but somehow it repeating the same record `SELECT DB2.processed_trans.Ra_num , DB1.processed_trans.Ra_num FROM DB2.processed_trans JOIN DB1.processed_trans ;` thanks, neil

Member Avatar
Member Avatar
+0 forum 8

I have a query that used union all.. and produces a table like this: `+-------------+------------------------+-----------+--------------+ | Type | Name | IDNum | Warnings | +-------------+------------------------+-----------+--------------+ | M | sample | 2013-1 | 4 | | L | sample | 2013-1 | 2 | +-------------+------------------------+-----------+--------------+` now i made a while loop to get the data under the warning column: while ($warning = mysql_fetch_objects($queryResult)){ switch($warning->Type){ case 'M': $M = $warning->Warnings;break; case 'L': $L = $warning->Warnings;break; } } but now then it only gives me the result of case M, its not looping back to check the other type to the switch case.. …

Member Avatar
Member Avatar
+0 forum 1

I have a temp table that is used in a union. But it resulted an error saying "cant reopen table". I've read that I need to rename the tempTable. How could I rename a temporary table when I'm using the tempTable in a union?

Member Avatar
Member Avatar
+0 forum 2

Hi All, Firstly I will say that this exercise is for my learning experiences through an online course. However I have spent a combined total of about 6 hours working on this question and I am completely stumped on how to get the correct answers. The question: > List the Title, Name and date of appointment for Governors General of Australia who were appointed between 01 January 1930 and 01 January 1960, together with the Prime Ministers who appointed them and all Leaders of the Opposition who served during their appointment. The date is to be formatted in dd/mm/yyyy format. …

Member Avatar
Member Avatar
+0 forum 2

Hi, I have two LINQ queries that produce two different results, but the fields, while having different names, are essentially the same. I am trying to union them together (although concat in this case should produce the same results), but I am getting an error. My thought is that I somehow need to declare the type of the resulting fields, but I am not sure how to do that and if it is correct. Could anyone guide me down the right path to figure out what is wrong? Thanks very much. I have the code and the error below. var …

Member Avatar
Member Avatar
+0 forum 7

I have MS EXCEL 2k3 problem: On my previous post I have the NOT the INTERSECTION of 2 sets of data using VLOOKUP() where is the equivalent function of INTERSECTION in Discrete Mathematics. Right now I was looking for forums if Excel has the ability to combine 2 sets of data not by concatination. In Database Programming the sets of data from multiple tables is possible by using UNION() others are possible also on JOIN(). Since in database programming was possible because I am more excellent in web programming than using excel and finding the possiblities if ever Excel has …

Member Avatar
+0 forum 0

Hi everyone, I would like to ask a question about MySQL. Say, I have a database like this: database 1: articles |- id |- title |- description database 2: tags |- id |- articleID |- tag I needed to search from articles.description and tags.tag and while doing so, the searched articles should get the *tag* from the tags table and the searched tags should get the *description* from the arcticles. displaying them as: title | description | tags I'm not really sure how to do this yet as I am not an expert when it comes to MySQL. An answer …

Member Avatar
Member Avatar
+0 forum 4

Dear All! I want to get my columns value into rows . i am taking sum of qty of each month . like this select sum(Case when month(invoicedate) = 1 then qty else 0 end) as janQty, sum(Case when month(invoicedate) = 1 then qty else 0 end) as febQty, sum(Case when month(invoicedate) = 1 then qty else 0 end) as marQty, . . . from Invoices above query is returning result like this janQty---------febQty---------marQty------------- --156-----------678-------------345------ and my required format is janqQty------156 febqQty------678 marqQty------345 . . . i can use union all like this this select 'jan' as month, sum(case when …

Member Avatar
Member Avatar
+0 forum 2

Hi, I am writing a Silverlight Bing Maps based application and I am trying to merge two (and more) polygons. The approach I am using at the moment is the following: The geometry for the polygons is stored in a database, and Im writing and reading from it through a WCF Service. So I get the geometry from the database, and I am dealing only with Polygons. The thing I did was to use the STUnion function in the SQL, through a StoredProcedure. It supposedly works, but here is the twist: Many of the polygons are not really sharing a …

Member Avatar
+0 forum 0

I am developing an sql query to use to grab information from a postgres db. The scenario is as follows: the database I am grabbing information is the backend postgres database of an application (Tableau). My objective is to pull all of the workbooks, views, and datasources (considered objects) that are untagged in the database. I am using 4 tables - taggings (contains all tagged objects related to the object by the objects id), views (contains all views and their ids), workbooks (contains all workbooks and their ids), and datasources (contains all datasources and their ids). I have already successfully …

Member Avatar
Member Avatar
+0 forum 7

Hello all, I'm hoping you can help me with my first search engine/join query. I have 3 tables with differing numbers of coulumns - clients, projects and tasks. Table "clients" with the columns "cid", "client" and "date" Table "projects" with the columns "pid", "cid", "projects" and "date" Table "tasks" with the columns "tid", "pid", "cid", "tasks", "company", "owner", "priority", "target" and "status". The purpose of the search is to find any given task quickly. I'd like the user to input a client name and see all the information from the 3 tables that pertain to that client. Similarly, the user …

Member Avatar
Member Avatar
+0 forum 1

Hi thought i'd try here see if anyone can help solve this quicker. First off we have a email database. The main table is the email data, all unique rows per email address with a unique id. eg. emailid,email 1,email@example.com 2,email@example.co.uk Next we have another table which logs the data of each time an email has been attempted to send such as incid,emailid,sent,campaign_id,datesent 1,1,1,send1,2012-02-20 2,2,0,send1,2012-02-20 3,1,1,send2,2012-02-27 4,2,1,send2,2012-02-27 The part i'm having trouble with is a query that pulls the next emails a campaign is up to [CODE=mysql]( SELECT * FROM `the_main_table` as `mt` LEFT JOIN `sentdata` AS `sd` ON mt.emailid …

Member Avatar
Member Avatar
+0 forum 20

I need a code which will print union of two strings. for example string1="1,2,3" string2="3,4,5" and print the result string3: 1,2,3,4,5 Could someone help me how to solve this?

Member Avatar
Member Avatar
+0 forum 7

Ok i have a lot of tables that are created when a user inputs information. Some info gets stored in a "Main" table while the majority is saved in its own self created table. I do not know the number of "topics" in Main table. so in way i'm trying to make a double query but i'm not sure if i'm saving the [ICODE]$all[/ICODE] variable correctly. [CODE] $sql= "select * from main"; $result=mysql_query($sql); $counter=mysql_num_rows($sql); $i="1"; $all= while($row=mysql_fetch_array($result)){; $all.= echo ”Select * From ". ($row[‘topic’]); $all.= if($i <$counter){; $all.= echo “ UNION ALL “; $all.= }else{; $all.= Echo “ ORDER BY …

Member Avatar
Member Avatar
+0 forum 1

Hi, my question is simply but a little bit tricky; let assume that there are two array array1 = (2, 5, 6, 1, 7) and array2 (3, 2, 6, 8) and after function setUnion new array or use pointer return (2, 5, 6, 1, 7, 3, 8). Below my code is shown my problem is I found (2, 5, 6, 1, 7, [B]8[/B], [B]8[/B]) How I fix this problem ? Here my code include main function:: [CODE] #include <iostream> using namespace std; void setUnion (const int array1[], const int size1, const int array2[], const int size2, int &newSize, int *&unionArray) …

Member Avatar
Member Avatar
+0 forum 9

I have a series of Key value pairs. Each Key has 2 values. Values of Keys ma coincide. Initially i start with Key1, ValueKey1, ValueKey2 are stored in a set.(Maybe Array). Now for each consecutive Keyi, i check if Valuei, Valuei+1 are in the set. If any one of them is in the set, then join the set. Else if both KeyValues are present in a set, discard that key . How can i implement this thing using C++, i have very less idea, so i would suggest if possible a code snippet or a hint would be really helpful. …

Member Avatar
Member Avatar
+0 forum 3

Is it possible to define a union at creation. ie: [CODE]union Colour { unsigned int i; char c[4]; struct{ char a; char r; char g; char b; }col; }Black(0xFF000000),White(0xFFFFFFFF),Red(0xFFFF0000),Green(0xFF00FF00),Blue(0xFF0000FF)/*etc...*/;[/CODE]

Member Avatar
Member Avatar
+0 forum 2

Hi, I need to find the 'length' of union between 2 vectors. The code I have is[CODE] vector<int> v1,v2; vector<int> unionsetv; vector<int>::iterator it; v1.push_back(1);v1.push_back(2);v1.push_back(3); v2.push_back(3);v2.push_back(2);v2.push_back(4); it = set_union(v1.begin(),v1.end(),v2.begin(),v2.end(),back_inserter(unionsetv)); cout << unionsetv.size()<< " "; cout << int(it - unionsetv.begin())<< " " ; [/CODE] I could not get this to work and I have used the set_union in the same way as given in the cplusplus.com reference. If I remove the iterator 'it' then I get the entire size of the unionsetv vector (here this is 6) but this will have zero values in it (obtained during union). What I need is …

Member Avatar
Member Avatar
+0 forum 7

I managed to duplicate a single record. However I intended to display the duplicate record with different values. For example: A ABC 065 001 A10111 Sell 54.847500 0 0 T ABC 065 001 A10111 Sell 50.847500 0 1 [CODE] SELECT case i.ordStatus when 'Queued' then 'N' when 'Filled' then 'A' when 'Partial Filled' then 'A' when 'Cancel' then 'C' end as 'ordStatus', f.code as 'exchCode', g.code as 'companyCode', h.code as 'branchCode', c.code as 'clientCode', i.transType as 'transType', case i.ordStatus when 'Queued' then ((i.quantity * i.price * i.exchRate) / j.denomination) when 'Filled' then ((i.adjust * i.price * i.exchRate) / j.denomination) when …

Member Avatar
+0 forum 0

please help me to create a student information portal using stucture and union program in c.it should contain five sudents. *for inputs we should use struct and for output we should use union and it also should have a controls...previous page, next page and escape for exit. i don't know the ascii codes for the three controls.. PLS HELP ME...

Member Avatar
Member Avatar
+0 forum 1

hello all i am using a query [ICODE]select 'hour','filename','tot_sent_count','tot_success','tot_prm_fail','tot_switchedoff','tot_other_error' UNION select hour,filename,sum(tot_sent_count),sum(tot_success),sum(tot_prm_fail),sum(tot_switchedoff),sum(tot_other_error) INTO OUTFILE '/tmp/hourlyFileMis(2011-03-09)' FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n' from tbl_mis where date_format(date_time,'%Y-%m-%d')='2011-03-09' group by hour,filename order by hour;[/ICODE] output is ok but one thing is not coming properly that header fields are coming at the last line while i want it at first line.output is as follows 11,admin.txt,2,0,0,0,0 12,spice.txt,1,1,0,0,0 12,fil-V194.txt,270954,135337,7255,45404,15387 12,admin.txt,5,3,1,0,0 13,fil-V193.txt,230031,160904,8805,40962,19453 14,fil-V191.txt,263089,146926,24669,76718,14893 15,fil-mnn6.txt,245439,169885,10239,47005,18431 16,fil-jann2.txt,260134,89141,17421,49061,8647 17,fil-jann4.txt,245439,121276,7440,34036,16174 18,fil-mnn3.txt,260134,0,0,0,0 9,spice.txt,3,0,0,0,0 hour,filename,tot_sent_count,tot_success,tot_prm_fail,tot_switchedoff,tot_other_error i want last line to be at first Line.

Member Avatar
Member Avatar
+0 forum 1

Hey all, new to this site but i'm trying to call multiple values from multiple mysql databnases to show up in one table, but its throwing up an error at line 55, or [CODE]while($row = mysql_fetch_array($result));[/CODE] so i was wondering if I'm causing havoc with this statement here, im new to php, and i'm not really enjoying the experience at the moment! Any help at all would be amazing... thanks! [CODE]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title><?php echo $pagetitle; ?></title> <meta http-equiv="Content-Type" Content="text/html; charset=utf-8" /> <link rel=stylesheet type="text/css" href="styles1.css"> </head> <body> <div id="header"> <div id="branding"> …

Member Avatar
Member Avatar
+0 forum 3

Hi, I have an expression tree in which the nodes are operators (union, intersection etc represented by a string "/u") or the nodes are std::sets. How could I access the std::set's values in order to carry out the tree evaluation using the operator functions(set_union(), set_intersection() etc) ? The expressions are pre and postfix. Thanks for any help, it's most appreciated.

Member Avatar
Member Avatar
+0 forum 3

HEllo this is reaaally urgent, the deadline is within less than an hour and thirty minute, and I lost hope that I can fix the problem myself. I know it has to do with pointers and allocating memory dynamically. The assignment was to use operator overloading to add two sets (adding two sets by getting the union of the two sets, which means all the elements in both set but not repeated). I figured out a way to do so but I think this memory problem is the cause why it's not working here is the constructor of the class …

Member Avatar
Member Avatar
+0 forum 4

Hi * I have spent the last 18 hrs or so trying to get the wright sql code or think of an alternative but I just can't get my head around it. If any one can help me it would be awsome. What I am trying to acheive is getting the correct id to echo out in the row variable. [CODE]<?php echo $row['id']; ?>[/CODE] but it has to based on the mysql table row user_id which is based on the session username so it works off the users table id. I have two tables one is users the other is …

Member Avatar
Member Avatar
+0 forum 7

I'm making some sort of mistake in the following code: [CODE]use xPress_CR select * from (SELECT * FROM dbo.T_JOBS WHERE ENDDATEANDTIME = null UNION SELECT * FROM dbo.T_JOBS WHERE STATUS = 'Failed')[/CODE] Any idea what I'm doing wrong?

Member Avatar
Member Avatar
+0 forum 2

Hello everyone! This is my first post, been a long time reader though. First of all, it's been a while since I don't program and I'm rusty (very). The problem is: I just can't learn how to use the JOIN or UNION commands, everything I read is confusing. I'm simply trying to retrieve info from two different tables (same db) at the same time. Here's my code: [code=php] if ($_POST['Teachers'] && $_POST['Students']) { $sql = "SELECT email FROM teachers"; //Here I also want to pull this off: SELECT email FROM students. $result = mysql_query($sql,$db); while ($row = mysql_fetch_row($result) or die(mysql_error())) …

Member Avatar
Member Avatar
+0 forum 7

The End.