It's been a while since I had to write raw MySQL queries and lost touch a bit. I have a following situation in tables  Company     Client_Company ID NAME     CLIENT_ID COMPANY_ID  -------     -------------------- 1  X        10         1  2  Y        12         1 3  Z        36         3   My scenario does not really involve a client but I will use 'client' as don't want to get into explaining the exact entity I'm using here.  So imagine I can associate companies with clients through a select box within client editing area. What I want to do is that every time next company is assigned to the same client, that company must not appear in the dropdown anymore.  So basically I need to select all records from the Company table, to display as available options for a client with ID=10 but excluding company with ID=1 (which is already assigned to client 10). How would I do that?
I've got the following two tables (in MySQL): Phone_book +----+------+--------------+ | id | name | phone_number | +----+------+--------------+ | 1  | John | 111111111111 | +----+------+--------------+ | 2  | Jane | 222222222222 | +----+------+--------------+  Call +----+------+--------------+ | id | date | phone_number | +----+------+--------------+ | 1  | 0945 | 111111111111 | +----+------+--------------+ | 2  | 0950 | 222222222222 | +----+------+--------------+ | 3  | 1045 | 333333333333 | +----+------+--------------+  How do I find out which calls were made by people whose phone_number is not in the Phone_book? The desired output would be: Call +----+------+--------------+ | id | date | phone_number | +----+------+--------------+ | 3  | 1045 | 333333333333 | +----+------+--------------+
I stupidly ran sudo chown -R carlos:carlos / and carlos is my user. This changed all files to be Carlos and I could not boot up again (because the root files were now owned by #1000) and I cant get sudo acess in live cd (because the owner of /usr was changed to my user). Can anyone help me? FYI I have mounted my hard drive. Rendering smoke in Cycles? How to use maths symbols in text mode? I try to add a center dot with \circ but it fails to compile. How to use maths symbol in text mode? The error message is   ovak, slovenian, spanish, swedish, turkish, turkmen, ukrainian, uppersorbian,  welsh, loaded. (/usr/local/texlive/2012/texmf-dist/tex/latex/base/article.cls Document Class: article 2007/10/19 v1.4h Standard LaTeX document class (/usr/local/texlive/2012/texmf-dist/tex/latex/base/size10.clo)) (./untitled-1.aux) ! Missing $ inserted. &lt;inserted text&gt;              $ When do we double the consonant before '-ing' affix? My son is learning how to spell. He is doing a good job listening to sounds and working out spelling that way (which doesn't work for many words, but at least a lot of common ones), but although he's gotten the -ing chunk, he frequently misses doubling letters in these words.  Is there a guideline for when the end consonant is doubled? He's working on these sorts of words:        riding   sitting   skating   writing   getting How do I configure Apache 2 to run Perl CGI scripts? I would like to configure Apache 2 running on Kubuntu to execute Perl CGI scripts. I've tried some steps that I came across by googling, but nothing seems to work.  What is the right way of achieving this? Ubuntu 20.04 Font and UI elements too big on login I'm running Ubuntu 20.04 on an ASUS X99-E-10G WS w/ an NVIDIA 1080Ti and an LG 4k 32&quot; monitor which persistently gets recognized as 27&quot;. When I log in, the text of certain UI elements is ~2x the normal size. After I go to settings/universal access and turn large text on and then off again, everything is the normal size I expect. Screenshot after logging in  After turning &quot;large text&quot; on  After turning &quot;large text&quot; off  How do I get the conditions I have after cycling the &quot;large text&quot; feature to be present immediately after booting? I have the 440 version of NVIDIA's drivers installed. Considering an ideal case(neglecting drag of air, damping etc.), a pendulum follows SHM if the angular displacement is small (upto 10 degrees). But, for large angular displacement(more than 10 degree), it does not follow SHM. Why? What force cause the pendulum not to follow SHM? Easy way to disable a UITextField? Is there an easy way to disable a UITextField in code?  My app has 12 UITextField that are all turned on by default, but when a change is detected in my Segment Control I want to disable some of the UITextField depending on what Segment the user picks.  Just need to know how to disable it or make it non-editable?  Thanks Creating a Snapshot of a Windows 7 System Is there a way to create a snapshot of a Windows 7 system?  My goal is to be able to save the current state of my Windows 7 OS, on external storage, and be able to restore it on the same hardware in the future. Much like a snapshot on a virtual machine.   One solution would be to install two hard drives in RAID 1, then take one of them out an store it. Is there an easier solution? Quantum mechanics and everyday nature Is there a phenomenon visible to the naked eye that requires quantum mechanics to be satisfactorily explained? I am looking for a sort of quantic Newtonian apple. How to create a SQL Server function to "join" multiple rows from a subquery into a single delimited field? How do I prevent new villager trades from spawning? When making a custom adventure map, usually you only want the trades you programmed into a villager to show up. By default, however, the game will try to spawn new trades when the last one is made. The classic way I'm seeing in tutorials to prevent new trades is to make the last trade untradeable; however, with the release of 1.7, a lot of the old item IDs that were unobtainable have been removed from the game altogether, and following the tutorial I have crashes the game when the trade interface is scrolled to the last trade.   So there's two parts to this question:   Is there a better way to prevent new trades with the 1.7 mechanics? Or with the snapshots of 1.8 mechanics? If not, what is a safe data ID to use to prevent the last trade from being a real trade as of 1.7? For a distribution function $F(x)$ and constant $a$, integral of $F(x + a) - F(x)$ is $a$. For any distribution function and any $a \geq 0$, $\int_{-\infty}^{\infty} (F(x+a)-F(x))dx = a$.   In this case, "distribution function" means a right continuous function F with $F(-\infty) = 0$, $F(\infty)= 1$.   This problem comes after a section in the book on mathematical expectation, so I suspect I should use some property of expectation to prove it. Expectation appears to be something that applies to random variables, so I think I should be somehow transforming the problem into something in terms of expectations of random variables, but I'm not sure how. I know that given a distribution function, I can get a probability measure, but I'm not sure how to go from there to a random variable and actually get a relation between the expectation of the random variable and this integral. I'm sure whether this is the right way to go about this problem, but if it is, I'm missing a connection somewhere. I used sculpting on a plane, and things looks great. However, when I press P to play, the whole ground become a mess. I can see through it in various places, and there are also nasty looking black edges everywhere.  another problem, I made a UV Sphere to display the sky, but when I press , P to play it disappears! How to boot Ubuntu persistent live USB on Android? I'm discovering the possibilities offered by persistent live USB using Ubuntu 19.10 and I was wondering if it would be possible to boot with Ubuntu on Android (i.e. using your computer capabilities through your smartphone) using those multi-plug USB sticks which have both USB3 and micro-USB2.  In other way: can I get some kind of a boot menu on an Android device in order to boot with a persistent live USB in order to access my Linux computer tools and setup from a wider range of devices? How to Combine two Normal Maps? I made a high poly model and then baked its textures onto a low poly model. Now I want to give another normal map's details to the model. How can this be done? Me and my friend want to build a basic 101 mob farm, but we can't decide where to put it. He says it has got to be over an ocean, I say it can just be 128 blocks above ground and it will be just fine.  So the question is:    What is the absolute ideal place for a mob spawner?  If we build it 128 blocks above ground do we still need to light up caves? If we dig a 128x128 square straight to bedrock will that make a perfect environment?   Please advise! How do I query for posts by partial meta key? I have a function that stores the "like" status for a post as post meta. I want to associate that "like" with the user that liked it, so I setup a custom field called "like_status_{user_id}" (where {user_id} is the id of the currently logged in user) which I store as a 0 or 1. So for a post with several "likes" there would be several meta values in the db that are setup like this:  'meta_key' = 'like_status_0' 'meta_value' = 1 'meta_key' = 'like_status_2' 'meta_value' = 1 'meta_key' = 'like_status_34' 'meta_value' = 1   ....and so on.  There are potentially thousands of likes on a specific post. How would I run a query that showed if someone else also liked that post?  I was thinking something like this:  $query = new WP_Query(array(     'meta_key' =&gt; 'like_status_{user_id}',     'meta_value' =&gt; 1, ));   I'm trying to push a notification to everyone who has liked a post when someone else likes that post...something like, "Hey, someone else liked that post you liked. You should go check it out!" But I need a way to find out if anyone else has liked that post and if so, who they would be so I could notify them.  If it's not possible, could you suggest a better way of storing this data as post_meta while still keeping the efficiency of quickly updating a single user's like status on a post? How do I migrate my Keychain's "Local Items" to a new Mac? After preforming a Mavericks-Mavericks migration using Migration Assistant, I have a "Local Items" Keychain on my new machine in which many (perhaps most) items are out of date (using old passwords), and some are missing altogether. While I have access to a copy of the entire contents of the ~/Library/Keychains/ directory from my old machine, which presumably contains all the information I'm missing, I see no way of importing that information into my new machine.  How can I import the "Local Items" from my old Keychain into the Keychain on my new machine? What apps are people using to record voice meetings on the iPad? I'm looking to do some light recording of voice conversations and field recordings on my iPad using the built in microphone.    seems to be the obvious Apple solution, but is too heavy for my needs. By the time I set up a new project, turn off the metronome, etc..., I find myself wishing I just had  running on my iPad.   I don't mind paying for the app, but wondered what people are using for both light voice recording as well as longer and more numerous recording / light editing where some tagging and filing might be possible.