Jump to content

Search the Community

Showing results for tags 'select'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Calendars

  • Community Calendar

Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 33 results

  1. SELECT JOIN - A Failed Query

    PROBLEM: Turn a two-step SELECT procedure into a one-step procedure. The two-step procedure is 1) Discover with a query to a parent table what other rows in the parent table are related to the queried row. 2) Obtain selected data for the queried row and other related rows from the parent table and a child table that are connected by a FOREIGN KEY. BACKGROUND: I have two tables -- a parent (parent_table) and a child (child_table) table - connected by a valid FOREIGN KEY and an additional table (ref_table) that contains information about the relationship among the rows of both the parent and child tables. Please find below the results of three SHOW CREATE TABLE statements to help you in your understanding of the table structure. In addition, I have included the INSERT statements for the child_table and ref-table. I accidentally destroyed the INSERT statement for the parent_table. This said, the parent and child tables are very similar in structure. DISCLAIMER: Please understand that the problem that I have created is heuristic in nature and is being used to create a prototype for subsequent, more practical use. The PARENT Table parent_table CREATE TABLE `parent_table` ( `id` int(3) NOT NULL DEFAULT '0', `usertype` enum('1','2','3') CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '2' COMMENT '1=good, 2=neutral, 3=bad', `username` char(150) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, PRIMARY KEY (`id`,`usertype`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 The CHILD Table child_table CREATE TABLE `child_table` ( `id` int(3) NOT NULL DEFAULT '0', `usertype` enum('1','2','3') CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '2' COMMENT '1=good, 2=neutral, 3=bad', `userbio` varchar(500) DEFAULT NULL, KEY `parent` (`id`,`usertype`), CONSTRAINT `child_table_ibfk_1` FOREIGN KEY (`id`, `usertype`) REFERENCES `parent_table` (`id`, `usertype`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=latin1 INSERT INTO `child_table` (`id`, `usertype`, `userbio`) VALUES ('1', '1', 'I am Roddy.'), ('2', '2', 'I am Beth.'), ('3', '3', 'I am Matt.'), ('4', '3', 'I am Tim.'), ('5', '2', 'I am Tylor.'), ('6', '1', 'I am Liz.'), ('7', '1', 'I am Aldo.'), ('8', '1', 'I am Adzit.'), ('9', '3', 'I am Jason.'), ('10', '3', 'I am David.') The REFERENCE Table ref_table CREATE TABLE `ref_table` ( `ref_id` int(3) NOT NULL DEFAULT '0', `id` int(3) DEFAULT NULL, `ref` int(3) DEFAULT NULL, `count_ref` int(1) DEFAULT NULL, KEY `par_ref` (`ref_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 INSERT INTO ref_table (ref_id,id,ref,count_ref) VALUES ('1','1','2','1'), ('2','1','6','2'), ('3','1','7','3'), ('4','2','6','1'), ('5','2','9','2'), ('6','4','1','1'), ('7','4','2','2'), ('8','4','6','3'), ('9','4','10','4'), ('10','5','6','1'), ('11','6','1','1'), ('12','6','2','2'), ('13','6','9','3'), ('14','7','5','1'), ('15','7','6','2'), ('16','8','1','1'), ('17','9','10','1'), ('18','10','4','1'), ('19','10','6','2'), ('20',10, NULL,'1'); EXPLANATION BY EXAMPLE: Say a user is interested in row 4 of the parent_table. When the database is queried a SELECT JOIN statement looks in the id field of the ref_table and finds four corresponding rows identified by ref_id 6, 7, 8, and 9. With each of these latter rows is associated a different row -- namely, 1, 2, 6, 10. Without further selection is returned all of the information contained in the parent_table and child_table associated with rows 1, 2, 4, 6, and 10. This is what is supposed to happen, but does not. The REJECTED SQL STATEMENT SELECT * FROM parent_table OUTER JOIN child_table ON parent_table.id = child_table.id OUTER JOIN ref_table ON parent_table.id = ref_table.id QUESTION ONE: Does the table structure make sense? Are the constraints properly set? QUESTION TWO: Why is my SQL statement rejected as poorly formatted? This is my first attempt to use the JOIN clause. So, please be as thorough with your answer as possible. I must believe that I have a long road ahead with MySQL and should prepare for it as i move forward. Roddy
  2. GOAL: Use one <select> element to determine the selected option of another <select> element without destroying the ability of the second <select> element to override the selection made by the first <select> element. BACKGROUND: My biggest difficulties in my attempt to achieve the above goal are: reading the value of the first <select> element's manually (not the automated) selected option. forcing the second <select> element to perform as if it were manually selected. Please consider the following two select statements and answer the following question with jQuery. <h4>The <em>from</em> Select Input Control</h4> <select id='item_podtype_exp' form='rss2_feed' name='item_podtype'> <option value='' selected='selected'>Select a type</option> --> <option value='1'>Concept</option> <option value='2'>Form and Use</option> <option value='3'>Clausal Analysis</option> <option value='4'>Linear Analysis</option> <option value='5'>Socratic Inversion</option> </select> <h4>The <em>to</em> Select Input Control</h4> <select id='itunes_podtype_exp' form='rss2_feed' name='itunes_podtype'> <option value='' selected='selected'>Select a type</option> <option value=1>Concept</option> <option value=2>Form and Use</option> <option value=3>Clausal Analysis</option> <option value=4>Linear Analysis</option> <option value=5>Socratic Inversion</option> </select> QUESTION: How does one go about achieving the above goal? Your response will hopefully answer many more questions than I have room for here. Roddy
  3. Read Multiple Rows Sequentially

    QUESTION ONE: What is it called when you traverse an entire table in equal multiples of records? (I ask this question, because I have been fraught with frustration in my google searches.) QUESTION TWO: Do you know a routine that I can copy and modify? (This would greatly simply my search.) BACKGROUND: Surely there must be a standard routine for performing the following procedure: 1) Use PHP to read and display the first ten records of a MySQL table. 2) Read and display the next ten records of the same data table. 3) Either return to the previously read ten records and display these or continue on to the following ten unread records and display them. 5) When you have reached the end of the table display only the remaining records. GOAL: Ultimately I would like to read and display 10 records in a list format. At the bottom of the list I would place two buttons. One that displays the previously 10 records and one that displays the next ten unread records. WHAT I HAVE ACHIEVED SO FAR: <?php $col_name = 'item_pubdate'; $result_obj = $mysqli_obj->query("SELECT * FROM rss2_podcast_item ORDER BY '$col_name' LIMIT 0, 10"); while($row=$result_obj->fetch_array()) { ?> <div class='table_row podcast_item'> <div class='flex_item num_div'><?php echo $row['podcast_no_item'] . '&nbsp'; ?></div> <div class='flex_item date_div'><?php echo $row['item_pubdate']; ?></div> <div class='flex_item title_div'><?php echo $row['item_title']; ?></div> </div><!-- end div.table_row --> <div class='table_row discover_div'> <div class='flex-item'>Discover more ...</div> </div><!-- end div.table_row --> <div class='table_row'> <div class='flex-item details_div'> <?php echo $row['item_description']; ?> </div><!-- end div.table_row --> </div><!-- end div.table_row --> <?php } ?> With a little additional CSS and Javascript I have been able to achieve the following display. Clicking on the phrase "Discover more ..." reveals the hidden detail obtained from $row['item_description]. No. Publication Date|Time Podcast Title 60 2017-06-19 17:26:41 Title Ten Discover more ... 59 2017-06-18 09:50:37 Title Nine Discover more ... . . . 51 2017-09-24 11:00:17 Title One Discover more ... DESIRE: If I can only achieve the above stated goal, I can likely figure out a way to get AJAX to allow users to select podcast items by the week, month, year, and later category. But, this is already much too far into the future. For the moment, I would simply like to achieve my above stated goal. Any ideas? Roddy
  4. Hello, I have a variable ($post) that contains posted content from database. Now I want to select the first paragraph and insert a code after it (Ads precisely ). Here is my code <?php include "../modules/gfuncs.php"; $topicId=(int)$_GET['id']; #check if topic exists $q=$conn->query("SELECT * FROM topics WHERE id='$topicId'") or die( $conn->error ); if(mysqli_num_rows($q)==0){ header("location: $thisDomain/notfound"); exit; } #check for post $c4p=$conn->query("SELECT * FROM posts WHERE topicid=$topicId") or die($conn->error); if(mysqli_num_rows($c4p)==0){ $delpost=$conn->query("DELETE FROM topics WHERE id=$topicId") or die($conn->error); header("location:$thisDomain/notfound"); exit; } #new comment $notify=""; $err=""; if(isset($_POST['post']) and isLoggedIn()){ $msg=$_POST['msg']; $fid=(int)$_POST['fid']; $thisdate=time(); $error=array(); #if user uploads attachment if($_FILES['attach']['size']>0){ $thumb=$_FILES['attach']; $thumbtmp=$thumb['tmp_name']; $thumbname=$thumb['name']; $thumbsize=$thumb['size']; $targetDir="thumbs/$thumbname"; $ext=pathinfo($targetDir, PATHINFO_EXTENSION); $allowed=array("jpg","gif","png"); if(!in_array($ext, $allowed)){ $error[]="Invalid thumbnail format"; } elseif($thumbsize > 2097152){ $error[]="Thumbnail size exceeded limit"; } } if(!$msg or empty($msg)){ $error[]="Please enter a comment"; } elseif( strlen($msg)<3){ $error[]="Comment too short"; } if(count($error)==0){ $newAttachName=""; if($_FILES['attach']['size']>0){ $newAttachName=encrypt(time()*rand(), 15).".jpg"; @move_uploaded_file($thumbtmp, "thumbs/$newAttachName"); } $save=$conn->query("INSERT INTO posts SET topicid=$topicId, forumid=$fid, poster='$curUser', postdate=$thisdate, post='$msg', attachment='$newAttachName'") or die($conn->error); $notify='<div class="successHolder">Comment Successfully Added!</div>'; } else { $err=implode(",<br>", $error); $notify='<div class="errorHolder">'.$err.'</div>'; } } $load=mysqli_fetch_object($q); $forumid=$load->forumid; $subject=_read($load->subject); $subjext=$load->subject; $poster=$load->poster; $views=$load->views; #update views $newviews=$views+1; $updviews=$conn->query("UPDATE topics SET views=$newviews WHERE id=$topicId") or die($conn->error); $postdate=$load->postdate; $postdate=date("d, M Y.", $postdate); $lastposter=$load->lastposter; $lastpostdate=$load->lastpostdate; $locked=$load->locked; $attachment=$load->attachment; #load forum info $fq=$conn->query("SELECT * FROM forums WHERE forumid=$forumid") or die($conn->error); $ft=mysqli_fetch_object($fq); $forumName=$ft->forumname; $forumUrl="$thisDomain/forum/$forumid/".urlize($forumName); #count posts $postCount=$conn->query("SELECT * FROM posts WHERE topicid=$topicId") or die( $conn->error); $totalPosts=mysqli_num_rows($postCount); #pagination $limit=13; $pagination= new paging; $pagination->totalResults($totalPosts); $pagination->rows_per_page($limit); $page=@$_GET['page']; $pagination->page($page); $pagination->thisPage("$thisDomain/forum/$forumid/topic/$topicId/".urlize($subjext)); $paging=$pagination->paging(); $paging.="<span class=\"tp\">Page ".$pagination->currentPage()." of ".$pagination->totalPages()."</span>"; $anotif=""; $adminMenu=""; if($isAdmin){ if(isset($_POST['adminAct'])){ $time=time(); $act=$_POST['admin_act']; if($act=="tag_topic"){ $qt=$conn->query("SELECT * FROM updates WHERE media='topic' AND media_id='$topicId'") or die($conn->error); if(mysqli_num_rows($qt)==0){ $qaa=$conn->query("INSERT INTO updates SET media='topic', media_id=$topicId, updatetime=$time") or die($conn->error); $anotif='<div class="successHolder">Topic successfully tagged to homepage</div>'; } else { $anotif='<div class="errorHolder">Topic is already in updates</div>'; } } elseif($act="untag_topic"){ $qaa=$conn->query("DELETE FROM updates WHERE media='topic' AND media_id=$topicId") or die($conn->error); $anotif='<div class="successHolder">Topic successfully removed from updates</div>'; } elseif($act=="del_topic"){ $qaa=$conn->query("DELETE FROM topics WHERE id=$topicId") or die($conn->error); $delPost=$conn->query("DELETE FROM posts WHERE topicid=$topicId") or die($conn->error); $delFromUpdates=$conn->query("DELETE FROM updates WHERE media='topic' AND media_id=$topicId") or die($conn->error); header("location:$thisDomain/forum"); exit; } elseif($act=="edit_topic"){ header("location:$thisDomain/forum/topiceditor"); exit; } } $adminMenu="<div class=\"ContentX\"><form method=\"post\" action=\"\">"; #TAGGING: check if topic is tagged or not $qt=$conn->query("SELECT * FROM updates WHERE media='topic' AND media_id='$topicId'") or die($conn->error); if(mysqli_num_rows($qt)==0){ $adminMenu.=" <input type=\"radio\" name=\"admin_act\" value=\"tag_topic\"> Tag Topic"; } else { $adminMenu.=" <input type=\"radio\" name=\"admin_act\" value=\"untag_topic\"> Untag Topic"; } $adminMenu.=" <input type=\"radio\" name=\"admin_act\" value=\"del_topic\"> Delete Topic"; $adminMenu.=" <input type=\"radio\" name=\"admin_act\" value=\"edit_topic\"> Edit Topic <button type=\"submit\" name=\"adminAct\" class=\"w3-btn\">Submit</button></form></div>"; } #resend query to initiate paging $postQ=$conn->query("SELECT * FROM posts WHERE topicid=$topicId ORDER BY id ASC LIMIT $pagination->offset,$pagination->rows_per_page") or die($conn->error); #load all posts $contents=""; $postMenu=""; while($loadp=mysqli_fetch_object($postQ)){ $postid=$loadp->id; $poster=$loadp->poster; $postdate=$loadp->postdate; $postAttach=$loadp->attachment; $post=""; if($postAttach){ $post='[img]'.$thisDomain.'/forum/thumbs/'.$postAttach.'[/img]'; } $post.=$loadp->post; $post=_bbcode(_read($post)); #get user info $usr=new userinfo; $usr->user($poster); $posterDP=$usr->get_info("dp"); $posterCity=$usr->get_info("city"); $posterState=$usr->get_info("state"); $postdate=date("g:ia, jS M Y.", $postdate); if($isAdmin){ $postMenu="\n<br>[<a href=\"$thisDomain/forum/editpost/$postid\">Edit Post</a>] / [<a href=\"$thisDomain/forum/delpost/$postid\">Delete Post</a>]"; } $contents.=<<<eof <div class="aPost"> <table class="info"> <tr> <td width="75"> <img src="$thisDomain/user/dps/$posterDP" height="70" width="70" id="infoDP"> </td> <td> <a href="$thisDomain/profile/$poster"><span class="fa fa-user"></span> $poster</a>. $posterCity, $posterState<br> <span class="fa fa-pencil"></span> $postdate </tr> </table> <div class="msgBody"> $post </div>$postMenu </div> eof; } $pageTitle=$subject; include "../header.php"; ?>
  5. Select using Alias returns "0"

    Hi, I am trying to learn basics of the SQL and following the tutorials on w3schools. Yesterday I was reading SQL Aliases and "Trying it myself". The following code returns 10 rows, each of them being zero. Am I missing something? SELECT FirstName + ' ' + LastName AS Name FROM Employees; Thanks.
  6. mysql join from 2 different databases

    Hi all, I have a question about join or inner join; not sure in what way it should be used. I now use 2 queries in 2 different databases (made in phpmyadmin). SELECT `title` FROM `writers` WHERE id ='qwert58efedd1979f'; SELECT `name`, `lastname`, `str`, `nr`,` place` FROM `client` WHERE id ='qwert58efedd1979f'; I would like to make one mysql query and use join to search in 2 tables in 2 different databases. Can anyone tell how mysql does this?
  7. Lack of Error Reporting

    Hi all, <?php require 'db/connect.php'; $result = $db->query("SELECT * FROM people"); ?> I obtained a blank page running the above script, which indicates that everything is fine (path and table name are correct). I then removed the * from the query to see if it would report an error, but it did not. I added print_r($result); and run it. Nothing has changed. I included the * and run, it reported the number of rows and columns in the table. Why there has a been a lack of error reporting in this instance, noting that the ini file is configured to report all sorts of errors, even the warnings and notices (and it is reporting all that in other scripts)?
  8. relational algebra

    hi, sorry, i have a question to do...but i know how to write in sql query ....however the answer need to write on relational algebra in query is like : SELECT * FROM operation where r='broken' group by pc having count(pc) >1 ; π id,pc,result ( σ r = 'broken' (operation)) like group by and having clasue...i no idea ... i searched on internet still @@ .... isnt the answer like that, i using split/step by step method to do rel 1 = σ r = 'broken' (operation) rel 2 = σ count(pc)>1 γ pc,count(pc) (rel 1)) rel 3 = π id,pc,result (rel 2 ) thanks
  9. update database records with php/mysql

    I have a piece of code where I use MYSQL to add records into a database. Here I use INSERT, but I want to work with UPDATE. The user selects records which have to be updated. The records have a unique number. I hope people can help me how to convert MYSQL code into PHP. The MYSQL code used in the console is this: UPDATE table_name SET input2='my input here ' WHERE rec_number = 2; The part of the script I use looks like this: <?php $name1 = $conn->real_escape_string($input1); $name2 = $conn->real_escape_string($input2); // $sql = "INSERT INTO $table (input1, input2 ) VALUES (' $name1 ', ' $name2 ')" ; // olde code // $sql = "UPDATE $table SET input2, input1 WHERE rec_number = $rec_number_selected VALUES (' $name1 ', ' $name2 ')" ; $sql = "UPDATE $table (input1, input2) VALUE S (' $name1 ', ' $name2 ') WHERE rec_number = $rec_number_selected " ; ?> Anyone any idea what the right code is in PHP?
  10. Html drop down menu

    I am attempting to create a drop down menu and I liked the style of the top home menu seen here http://www.lego.com/en-us/products (right near the lego symbol) but I am not sure how to create a similar one would some one gI've me guidance on how I can do this I just started html coding so I am a noon with little knowledge of html right now.
  11. So my goal is now to have a table list read from the database. The content of the table is supposed to be put in an <SELECT> <OPTION VALUE> form for a dropdown menu having the user select only 1 value. $conn = new mysqli($servername, $username, $password, $dbname); if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $sql = "SHOW TABLES"; if (!$result = $conn->query($sql)){ die('There was an error running the query[' .$conn->error. ']'); } foreach($row = $result->fetch_assoc()){ echo "<center>"; $reeks = implode(" " , $row); // echo $reeks; // echo "<br>"; echo "</center>"; ?> <center> <form name = "inpform" method="post" action="Add-succ7.php"> <SELECT > <option value = "<?php echo $reeks; ?>" > </option> </SELECT> </center> <?php } mysqli_close($conn); ?> Do I have to do this with foreach or while? (or something else?) In the checkbox version I use while but when doing that I get a list of 8 checkboxes without any value. I see the dropdown menu is placed in the loop of while so another condition (like foreach) seems to be the first thing to think about. But what kinda solutions would you have for the script above?
  12. Form's datalist input

    Beeing in a HTML page how can I return a PHP array into a Form's datalist input ?
  13. Dear All; Need your help. I am programming students' roll call in ASP with SQL 2008 R2. There are about 100 students. By default option selected is 'Present' using drop down list. I tried to use radio buttons but only one button remains selected so I am using drop-down list ( How to select multiple radio buttons?). After selecting "Present", "Absent","Late" etc, how do I insert all 100( or whatever number) of rows in the SQL table simultaneously? How should I use "for", "loop" or any other method? Please guide. Regards DAMODAR
  14. multiple select mysql

    i'm trying to select columns with multiple conditions. i want to select all 'tr_type' for all 'aid's but not 'SALES' & 'PURCHASE' for aid in '1' & '2'. i tried --- SELECT * FROM tran WHERE aid NOT IN ('1','2') AND tr_type IN ('SALES','PURCHASE') ORDER BY date it didn't work. please suggest....
  15. error on sql select limit

    why these lines are not working? $sql3 = "SELECT *,sum(amt),sum(qty) FROM purchase WHERE sid=$sid AND pvn!=0 ORDER BY pvn DESC LIMIT 2";$result3 = mysqli_query($connect, $sql3) or die(mysqli_error($connect));$row3 = mysqli_fetch_array($result3);echo $row3['sum(qty)'] . "<br />";$sql4 = "SELECT *,sum(amt),sum(qty) FROM purchase WHERE sid=$sid AND pvn!=0 ORDER BY pvn DESC LIMIT 3";$result4 = mysqli_query($connect, $sql4) or die(mysqli_error($connect));$row4 = mysqli_fetch_array($result4);echo $row4['sum(qty)'] . "<br />"; they both SELECT result from the complete rows on 'purchase' table. please guide what is wrong in it!
  16. I need the widget to be in my website. Any easy way that i can walk around to embed a widget inside my web can help
  17. dropdown menu items

    how to make a dropdown menu on a FORM with the datas from a column of a database table like items from all rows of a "MEMBERS" table's "NAME" column
  18. Need help with complex mysql query

    I am a beginner / intermediate MySQL user, but I need what I believe is a fairly advanced sql query, and I haven't been able to figure it out on my own. If someone could please help, I would really appreciate it. Here is my current query, and it IS returning valid data: $result = mysqli_query($con, "SELECT r.asset_title, r.alt_code, r.studio, r.type, r.start_win, r.end_win, r.rcv_date, r.pub_date, r.date_r4qc, r.qc_status, r.qc_notes, r.re_qc_date, r.promo_date, from_unixtime(ft.in_time) AS in_time, f.description AS description, left(ft.file_name, 20) FROM calendars r, tracker ft, folder f WHERE (r.alt_code = left(ft.file_name, 20) and ft.folder_id = f.id) limit 100"); Here's what I'm trying to accomplish: Most of the data that I need is in a single table, but there is one single field in each of two different tables, that I need to incorporate into my web output. The problem is, that the current status, and the date associated with that current status, are not sorted in any specific order. For each asset in the "calendars" table, I need to list all of the statuses, to include the "latest" status from the tracker table... In other words, for each asset in the "calendars" table, I need to look at the latest entries in the "tracker" table, then sort the "tracker" table output, returning the latest entry from that table. The above query IS returning valid data, but the data being returned from the tracker table is not always the latest data... How can I modify the above query to get just the latest entry from the tracker table? Again, any help would be greatly appreciated. Thanks in advance, and Merry Christmas to all... JCF
  19. New to Javascript. I am trying to show the selected value after the change so I can do some additional processing, but I cannot get my code to run. I am not sure my syntax is correct using java script.? <html> <head> <title>This is my test site</title> <script> function test(value) { value = document.getElementById("colorOption").selectedIndex; alert("document.getElementById("colorOption")[x].value); } </script> </head> <select id = "colorOption" name "colorOption" onchange = "test(value)"> <option value = 0>Red</option> <option value = 1>Green</option> <option value = 2>Blue</option> <option value = 3>Yellow</option> <option value = 4>Purple</option> </select>     </body> </html>
  20. Sort using CASE and LEN

    Hello guys, i need some experienced info here.. i need to sort selected data, thats why i used case like: SELECT * FROM Customers ORDER BY CASEWHEN CustomerName LIKE '%a%' THEN 1WHEN CustomerName LIKE '%b%' THEN 2ELSE 3END Everythings fine here, but I need to sort each sector (1, 2 and 3) seperately by CustomerName`s lenght. How to do that? any ideas ?
  21. hi there, the following query was developed and works as it should. SELECT ( SELECT COUNT(DISTINCT SP1.bigint_ProspectID, PLS1.smallint_ProspectOrdinal) FROM 10_serviceprospects SP1 LEFT JOIN 13_prospectleadsent PLS1 ON SP1.bigint_ProspectID = PLS1.bigint_ProspectID WHERE PLS1.timestamp_Sent BETWEEN "2013-08-01 00:00:00" AND "2013-08-30 23:59:59" AND SP1.bigint_ServiceID = SS.bigint_ServiceID AND PLS1.bigint_SupplierID = S.bigint_SupplierID ) AS `Previous Month`, ( SELECT COUNT(DISTINCTROW SP2.bigint_ProspectID, PLS2.smallint_ProspectOrdinal) FROM 10_serviceprospects SP2 LEFT JOIN 13_prospectleadsent PLS2 ON SP2.bigint_ProspectID = PLS2.bigint_ProspectID WHERE PLS2.timestamp_Sent BETWEEN "2013-09-01 00:00:00" AND "2013-09-31 23:59:59" AND SP2.bigint_ServiceID = SS.bigint_ServiceID AND PLS2.bigint_SupplierID = S.bigint_SupplierID ) AS `Last Month`, ( SELECT COUNT(DISTINCT SP3.bigint_ProspectID, PLS3.smallint_ProspectOrdinal, PLS3.bigint_SupplierID) FROM 10_serviceprospects SP3 LEFT JOIN 13_prospectleadsent PLS3 ON SP3.bigint_ProspectID = PLS3.bigint_ProspectID WHERE PLS3.timestamp_Sent BETWEEN "2013-10-01 00:00:00" AND "2013-10-30 23:59:59" AND SP3.bigint_ServiceID = SS.bigint_ServiceID AND PLS3.bigint_SupplierID = S.bigint_SupplierID ) AS `Current Month`, ( SELECT COUNT(DISTINCT SP0.bigint_ProspectID, PLS0.smallint_ProspectOrdinal) FROM 10_serviceprospects SP0 LEFT JOIN 13_prospectleadsent PLS0 ON SP0.bigint_ProspectID = PLS0.bigint_ProspectID WHERE PLS0.timestamp_Sent BETWEEN "2013-08-01 00:00:00" AND "2013-10-30 23:59:59" AND SP0.bigint_ServiceID = SS.bigint_ServiceID AND PLS0.bigint_SupplierID = S.bigint_SupplierID ) AS `Total`, S.text_SupplierName AS `Supplier Name` FROM 5_suppliers S JOIN 4_servicesuppliers SS ON (S.bigint_SupplierID = SS.bigint_SupplierID) WHERE SS.bigint_ServiceID = 1 # Bakkie Canopies OnlyAND S.smallint_SupplierStatus = 4 # Freemium Suppliers OnlyGROUP BY S.bigint_SupplierID ORDER BY `Total` DESC, `Supplier Name` ASC; # Order by Total, then Supplier Name took about a day to develop this inbetween other work. it returns the correct data. the output is available at https://performatix.co/csv/Bakkie_Canopies_Freemium_Supplier_Opportunities_2013-10-09.csv i was then requested to change the ordering by `Total` and primarily by `Region Description`; as well as grouping by Region ID and primarily by Supplier ID, creating a secondary output. SELECT R.text_RegionDescription AS `Region Description`, ( SELECT COUNT(DISTINCT SP1.bigint_ProspectID, PLS1.smallint_ProspectOrdinal) FROM 10_serviceprospects SP1 LEFT JOIN 13_prospectleadsent PLS1 ON SP1.bigint_ProspectID = PLS1.bigint_ProspectID WHERE PLS1.timestamp_Sent BETWEEN "2013-08-01 00:00:00" AND "2013-08-30 23:59:59" AND SP1.bigint_ServiceID = SS.bigint_ServiceID AND PLS1.bigint_SupplierID = S.bigint_SupplierID AND SP1.bigint_RegionID = R.bigint_RegionID ) AS `Previous Month`, ( SELECT COUNT(DISTINCTROW SP2.bigint_ProspectID, PLS2.smallint_ProspectOrdinal) FROM 10_serviceprospects SP2 LEFT JOIN 13_prospectleadsent PLS2 ON SP2.bigint_ProspectID = PLS2.bigint_ProspectID WHERE PLS2.timestamp_Sent BETWEEN "2013-09-01 00:00:00" AND "2013-09-31 23:59:59" AND SP2.bigint_ServiceID = SS.bigint_ServiceID AND PLS2.bigint_SupplierID = S.bigint_SupplierID AND SP2.bigint_RegionID = R.bigint_RegionID ) AS `Last Month`, ( SELECT COUNT(DISTINCT SP3.bigint_ProspectID, PLS3.smallint_ProspectOrdinal, PLS3.bigint_SupplierID) FROM 10_serviceprospects SP3 LEFT JOIN 13_prospectleadsent PLS3 ON SP3.bigint_ProspectID = PLS3.bigint_ProspectID WHERE PLS3.timestamp_Sent BETWEEN "2013-10-01 00:00:00" AND "2013-10-30 23:59:59" AND SP3.bigint_ServiceID = SS.bigint_ServiceID AND PLS3.bigint_SupplierID = S.bigint_SupplierID AND SP3.bigint_RegionID = R.bigint_RegionID ) AS `Current Month`, ( SELECT COUNT(DISTINCT SP0.bigint_ProspectID, PLS0.smallint_ProspectOrdinal) FROM 10_serviceprospects SP0 LEFT JOIN 13_prospectleadsent PLS0 ON SP0.bigint_ProspectID = PLS0.bigint_ProspectID WHERE PLS0.timestamp_Sent BETWEEN "2013-08-01 00:00:00" AND "2013-10-30 23:59:59" AND SP0.bigint_ServiceID = SS.bigint_ServiceID AND PLS0.bigint_SupplierID = S.bigint_SupplierID AND SP0.bigint_RegionID = R.bigint_RegionID ) AS `Total`, S.text_SupplierName AS `Supplier Name` FROM 5_suppliers S JOIN 4_servicesuppliers SS ON (S.bigint_SupplierID = SS.bigint_SupplierID) JOIN 1_regions R ON (SS.bigint_RegionID = R.bigint_RegionID)WHERE SS.bigint_ServiceID = 1 # Bakkie Canopies OnlyAND S.smallint_SupplierStatus = 4 # Freemium Suppliers OnlyGROUP BY SS.bigint_RegionID, SS.bigint_SupplierID ORDER BY `Total` DESC, `Region Description` ASC; # Order by Total, then Region Description this took about an hour inbetween other work. the results are in https://performatix.co/csv/Bakkie_Canopies_Regional_Freemium_Supplier_Opportunities_2013-10-09.csv however you will notice that the values do not corroborate with the first (this was discovered recently after reviewing the csv's! what is wrong with this query to get it to corroborate with the first?). i was then asked to order by `Total` but primarily by `Region Description`, and group by Region ID - creating a third output. SELECT R.text_RegionDescription AS `Region Description`, ( SELECT COUNT(DISTINCT SP1.bigint_ProspectID, PLS1.smallint_ProspectOrdinal) FROM 10_serviceprospects SP1 LEFT JOIN 13_prospectleadsent PLS1 ON SP1.bigint_ProspectID = PLS1.bigint_ProspectID WHERE PLS1.timestamp_Sent BETWEEN "2013-08-01 00:00:00" AND "2013-08-30 23:59:59" AND SP1.bigint_ServiceID = SS.bigint_ServiceID AND PLS1.bigint_SupplierID = S.bigint_SupplierID AND SP1.bigint_RegionID = R.bigint_RegionID ) AS `Previous Month`, ( SELECT COUNT(DISTINCTROW SP2.bigint_ProspectID, PLS2.smallint_ProspectOrdinal) FROM 10_serviceprospects SP2 LEFT JOIN 13_prospectleadsent PLS2 ON SP2.bigint_ProspectID = PLS2.bigint_ProspectID WHERE PLS2.timestamp_Sent BETWEEN "2013-09-01 00:00:00" AND "2013-09-31 23:59:59" AND SP2.bigint_ServiceID = SS.bigint_ServiceID AND PLS2.bigint_SupplierID = S.bigint_SupplierID AND SP2.bigint_RegionID = R.bigint_RegionID ) AS `Last Month`, ( SELECT COUNT(DISTINCT SP3.bigint_ProspectID, PLS3.smallint_ProspectOrdinal, PLS3.bigint_SupplierID) FROM 10_serviceprospects SP3 LEFT JOIN 13_prospectleadsent PLS3 ON SP3.bigint_ProspectID = PLS3.bigint_ProspectID WHERE PLS3.timestamp_Sent BETWEEN "2013-10-01 00:00:00" AND "2013-10-30 23:59:59" AND SP3.bigint_ServiceID = SS.bigint_ServiceID AND PLS3.bigint_SupplierID = S.bigint_SupplierID AND SP3.bigint_RegionID = R.bigint_RegionID ) AS `Current Month`, ( SELECT COUNT(DISTINCT SP0.bigint_ProspectID, PLS0.smallint_ProspectOrdinal) FROM 10_serviceprospects SP0 LEFT JOIN 13_prospectleadsent PLS0 ON SP0.bigint_ProspectID = PLS0.bigint_ProspectID WHERE PLS0.timestamp_Sent BETWEEN "2013-08-01 00:00:00" AND "2013-10-30 23:59:59" AND SP0.bigint_ServiceID = SS.bigint_ServiceID AND PLS0.bigint_SupplierID = S.bigint_SupplierID AND SP0.bigint_RegionID = R.bigint_RegionID ) AS `Total`FROM 5_suppliers S JOIN 4_servicesuppliers SS ON (S.bigint_SupplierID = SS.bigint_SupplierID) JOIN 1_regions R ON (SS.bigint_RegionID = R.bigint_RegionID)WHERE SS.bigint_ServiceID = 1 # Bakkie Canopies OnlyAND S.smallint_SupplierStatus = 4 # Freemium Suppliers OnlyGROUP BY SS.bigint_RegionID ORDER BY `Total` DESC, `Region Description` ASC; # Order by Total, then Region Description this took approximately another hour between other work. the results are in https://performatix.co/csv/Bakkie_Canopies_Regional_Freemium_Supplier_Opportunities_2013-10-09.csv once again - the data does not corroborate with the first csv, the issue i am facing is that i do not understand why the queries are not synchronous to the data... the first query works just as well for a different service, however the second and third queries do not return anything at all. i am assuming that this is because they do not have varying regions (all the same). further than this i just keep hitting my head... anyone comfortable enough to have a look at the queries and suggest changes other than the ones i applied? the data from the tables are available at https://performatix.co/csv/1_regions, 2_servicescatalogue, 4_servicesuppliers, 5_suppliers, 10_serviceprospects & 13_prospectleadsent.csv.
  22. I would swear I have seen an input type that was somewhere between a plain ol' text box and a select. In other words, the user could choose from the drop-down list or, if their choice was not found in the list, they could type in whatever they wanted. Is there such a control? I spent some time on http://w3schools.com looking for this, but found nothing.
  23. If statment in select (ORACLE)

    Hi I have simply select and works great: select 'CARAT Issue Open' issue_comment, i.issue_id, i.issue_status, i.issue_title, i.ISSUE_summary ,i.issue_description, i.severity,gcrs.Area_name, gcrs.sector_name,substr(gcrs.stream_name,1,case when instr(gcrs.stream_name,' (')=0 then 100 else instr(gcrs.stream_name,' (')-1 end) ISSUE_DIVISION,case when gcrs.STREAM_NAME like 'NON-GT%' THEN 'NON-GT' ELSE gcrs.STREAM_NAME END as ISSUE_DIVISION_2from table(f_carat_issues_as_of('31/MAR/2013')) iinner join v_gcrs_with_stream gcrs on i.segment_id = gcrs.segment_idwhere UPPER(ISSUE_STATUS) like '%OPEN%' Now I want to callte two columns: ISSUE_DIVISION and ISSUE_DIVISION_2 if they are equal in new columns should be value 1 if are not equal should be 0, how can I do it ?
  24. http://jsbin.com/azipok/2/edit this piece of code does the trick of clearing up the option list of select menu and adding a "test" message, but this message becomes visible only upon dropping down the select menu. is there a way to make this "test" message display and replace the "no modules..." text upon clicking the button?
  25. For example, if you select the option with id="chocolate-yes" or id="vanilla-yes", the the option with id="icecreamcone-yes" will also be selected.As you can see on the image below, when you select the option with id="chocolate-yes", <select id="icecreamcone"> will be disabled. When both id="chocolate-yes" and id="vanilla-yes" are not selected the the option with id="icecreamcone-no" will not be disabled. To put it in simpler words: you always need to have an ice cream cone if you want to add vanilla or chocolate ice cream, with the exception of sprinkles Anyone know of a Javascript that can do this? Note 1: the option with id="sprinkles-yes" will not effect id="icecreamcone-yes".Note 2: id="icecreamcone-yes" need still be selectable prior to selecting id="vanilla-yes" or id="chocolate-yes".Note 3: id names cannot be changed, nor can you add more properties to the elements.Note 4: cannot use jQuery. <ul id="icecream" style="list-style:none;line-height:30px;"> <li> <select id="icecreamcone"> <option value="addicecreamcone">Would you like an ice cream cone?</option> <option id="icecreamcone-yes" value="yes">Yes</option> <option id="icecreamcone-no" value="no">No thanks</option> </select> </li> <li> <select id="vanilla"> <option value="addvanilla">Would you like to add vanilla ice cream?</option> <option id="vanilla-yes" value="yes">Yes</option> <option id="vanilla-no" value="no">No thanks</option> </select> </li> <li> <select id="chocolate"> <option value="addchocolate">Would you like to add chocolate ice cream?</option> <option id="chocolate-yes" value="yes">Yes</option> <option id="chocolate-no" value="no">No thanks</option> </select> </li> <li> <select id="sprinkles"> <option value="addsprinkles">Would you like to add sprinkles on top?</option> <option id="sprinkles-yes" value="yes">Yes</option> <option id="sprinkles-no" value="no">No thanks</option> </select> </li></ul>
×