Jump to content

jbradley04

Members
  • Posts

    58
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

jbradley04's Achievements

Member

Member (2/5)

0

Reputation

  1. Hello all, I am trying to find a user that is NOT IN another table. Here is the code I have but it is not working. Any help would be greatly appreciated! select * from user as u, where u.GroupID=9 and u.ID NOT IN (SELECT CBy FROM stories WHERE Con BETWEEN '2014-07' AND '2015-07' AND CBy IS NOT NULL) Thanks for the help!
  2. Ok, Great! That works awesome! I really appreciate all the help!
  3. Well, that it is definitely the most progress I have made for speed! The problem is when I enter abcdhlkd blackball comes as a result. This cannot be though because there is only one l Any thoughts?
  4. Sorry, I posted the above in the wrong spot... Although it does apply to my problem too! Any answers on how to limit it to exactly the characters entered?
  5. Well, that it is definitely the most progress I have made for speed! The problem is when I enter abcdhlkd blackball comes as a result. This cannot be though because there is only one l Any thoughts?
  6. I am doing a MySQL query in which the WERE clause contains an array that would have up to 100's of clauses. Basically I have a DB of words. When people enter letters to search for words containing those letters, and only those letters, it will at that to the query. For Example: * The code below is extremely abbreviated but you should get the point. <?php /* Say someone enters "abc" So I have it setup that $word = 'a' , OR `word` = 'b' , OR `word` = 'c' , OR `word` = 'ab' , OR `word` = 'ac' , OR `word` = 'ba' , OR `word` = 'ca' , OR `word` = 'cb' , OR `word` = 'abc' , OR `word` = 'cba' , OR `word` = 'bca' */ $sql = mysql_query("SELECT * FROM `words` WHERE `word` = ".$words." ORDER BY `word` DESC"); ?> Well this turns out to be quick with "abc" but if you enter abcdefg the combinations would be thousands and brutally slow! Is there a way to speed things up with a better, more optimized query? Thanks for your help!
  7. Quick question. When I use the OR command it returns words that contain more than what I want. For example: If I search "ogf" Right now it would come up with friend, hog, ogor, etc... because they contain at least one of those letters. I am looking for it to come back with ONLY words that contain the letters searched. So ogf would only come up with: fog of But no other words that only contain one or all those letters but also have other letters too. Hope that makes sense! Thanks
  8. Thank you for your help! That is a little beyond my knowledge so I appreciate you helping me out. I would have never got that! Thanks again, J
  9. Hello, I am trying to run MySQL query that will take a bunch of letters and do a couple things. First: If they enter "drea" then I want to search for all words in my DB that contain those letters and only those letters. So the result will be" read dear ear red etc..... Next I want to run another query that would have Exactly the letters in the word. So the same query "drea" would only come up with: read dear Any help would be greatly appreciated! Thanks!
  10. Thanks everyone, I will get working on this today! I really appreciate all the input! J
  11. Only part I care about is username. So, if the username is the same I dont want it. If the username is the different, I am transferring it. Long story, but I ran a script that Identified who was similar based on other info. So ones that were same name but different info were appended to with random characters so they would be unique. So, I guess what I need to find out is how to run this based solely on usernames and nothing else? When there is not a duplicate username it will be added, otherwise ignored. Thanks for all your help!
  12. I'm not. But it is still giving me zero rows... this is what I have... $sql = mysql_query("SELECT * FROM `tb1`.`users`"); while ($row = mysql_fetch_array($sql)) { $sql2 = mysql_query("INSERT IGNORE INTO `tb2`.`users` (`user_type`,`group_id`, `user_permissions`, `username`) VALUES ('".$row['user_type']."','".$row['group_id']."','".$row['user_permissions']."','".$row['username']."')"); $latestID = mysql_insert_id(); echo $latestID."<br>";
  13. Thanks, Jessica. Problem is because userID and username are both unique it seems to show zero rows. I dont care about userID because they are auto incrementing and will be assigned a new one. Is there any way to do IGNORE on just username field? Thanks!
  14. Sorry, let me be more descriptive. I have two user tables, both with the same fields but in different DB's. Basically, I am looking to merge the two user tables into one DB and one table, lets call `user` Now, when the conflicting area would be the usernames. So I am looking to move only usernames that are unique to the second DB. So if DB1.user had username of 'test' and DB2.user had username 'test' then this will not get moved over. The biggest issue though is that there are tables in both DB's that depend on the userID of these usernames to correlate them to their respective privileges. So, if I change the data to the new table, its userID changes to a new userID because they are Auto Incremented. So I am looking to make the changes, then get the new insert ID and change the tables that are dependent on the userID. I hope I am explaining this enough. I appreciate all the responses.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.