I am performing UNION while getting the same type of information (company_name, vat, and email) from two different tables (adv and pub). The SQL query is below: SELECT TRIM(UPPER(company_name)), vat, company_owner_email FROM ( (SELECT company_name, v
I am trying to do a "WHERE AND WHERE OR WHERE" query with laravel, basically what I want to do is get all the events where the user_id equals a certain something AND where type = 'something1' OR 'something2' but right now the event is now only s
I am new to SQL and I just can't figure out how to calculate the average of a certain value in two tables. I have one table that is having all the information of the lakes in the world and i have another tables including all the information of the se
I thought that you needed to list the tables that you would be working with in a FROM clause as in: SELECT * FROM a, b WHERE a.id = b.id I am learning about joins and saw the following: SELECT a.account_id, a.cust_id, a.open_date, a.product_cd FROM a
I have 2 tables TABLE USERS USER_ID------USERNAME------------REGISTERTIME 1-----------------admin----------1432985224 2-----------------test ----------1433985224 3-----------------test2----------1332985224 TABLE REFERRALS REFERRER_ID----------REFERRA
I am still learning SilverStripe, and right now, I have a list of 50-60 pages I have to create for a site. It was suggested that I find a way to auto-populate the SilverStripe site tree with some code in order to save time (as opposed to manually cre
I have a table in a database with a section called custom field type. If this matches as "textfield" i want to echo a textfield, if it matches "textarea" i want to echo a text area. Can somebody let me know what I'm doing wrong below p
I have a file called "mysql.sql". I have installed mysql on Raspberry Pi, and I need to create the same tables in "mysql.sql". How can I manage to copy "mysql.sql" file directly into my database?Using input redirection. mysql
Is there a function wich can convert a date in format like : 31/07/2014 to a format date like 2014-07-31 I want to do this because in my sql query when i put the date in the format with " / " it doesn't understand te format :/ I have this messag
I want to run this query : SELECT firstName , secondName , lastName FROM (SELECT firstName,secondName,lastName FROM table1 UNION SELECT firstName,NULL,NULL FROM table2 )resutls I want add two Null columns to the second test, How could I do that ? or
I want to copy/update data from Table A to Table B. Table B has some more additional columns. I have tried the following options. 1) `REPLACE INTO `B` (SHOW FIELDS FROM 'A') SELECT * FROM `A 2) `REPLACE INTO `B` (SELECT `COLUMN_NAME` FROM `INFORMATIO
I have a mysql database on phpmyadmin, I installed the connector 6.8.3 (http://dev.mysql.com/downloads/connector/net/) I add a reference on the driver ((c:\Program Files\MySQL\MySQL Connector Net 6.8.3\Assemblies\v4.5\MySql.Data.dll) and I use this c
I need help with some MySQL commands. My MySQL table look's like this mysql> DESCRIBE sensor_readout; +-----------+-----------+------+-----+---------------------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------+-----------+------
Using SQL databases, it is easy to do statistical / aggregate functions like covariance, standard deviation, kurtosis, skewness, deviations, means and medians, summation and product etc, without taking the data out to an application server. http://ww
How can I use Cloud SQL to create a database? When I use MySQL, I could easily run a sql script to create them on phpMyAdmin. I found a site that advertises that it's possible to run SQL files right on Google Cloud SQL. This is exactly what I want to
i have problem with my site. i want to create a page in php. in this page i want user invite user. but i have a error. i dont know what to do. thx all . the error: SQL Error: You have an error in your SQL syntax; check the manual that corresponds to
I have a problem when I want to insert multiple fields into one table. Here's my form: <h1>Add user</h1> <form method="post" action="index.php"> <table> <thead> <th>Name</th> <th>Age</
I have the following MySQL Trigger SET @iUserId = OLD.LastChangedBy; IF NOT NEW.LastChangedBy <=> OLD.LastChangedBy THEN SET @iUserId = NEW.LastChangedBy; END IF; IF NOT NEW.BookingId<=> OLD.BookingId THEN INSERT INTO AuditTrail VALUES (UUID()
Consider 3 tables (* for primary key, + for foreign): User {*id:INTEGER, name:VARCHAR(45)} Flight {*id:INTEGER, service:VARCHAR(45), departureDate:DATETIME} Reservation { +userId, +flightId } Data: User: Flight: Reservation: The following Query will
Just a quick architecture question really on storing calendar data. Basically, I have a database of services for rental. On the front end, there is a calendar to show either "Available" or "Unavailable" for every future date. In the ba
I am attempting to paginate a shuffled ActiveRecord query. The syntax for doing this using the Kaminari gem is: @users = Kaminari.paginate_array(User.all.shuffle).page(params[:page]).per(20) The issue with this is that User.all is re-shuffled on each
I'm losing accented characters. From PHP I download an xml file which uses UTF8, while my PHP script uses Latin1. I can't manage to convert the UTF8 into Latin1. I've tried this: $meta=mb_convert_encoding($meta,'CP1252','UTF-8'); and $meta=mb_convert
I know how to create random chars both at PHP and MySQL but the question is that I have to create a 4 char random string for a table of 10 thousand or so rows. What way is the best to make sure it will remain unique? I can use a longer string if I ne
My MySQL database has carefully defined fields. Some fields, if there is a chance that they can be unknown, allow a NULL value. I'm writing a web-based CMS to handle the data in said database. Obviously, the post arrays from the HTML forms never cont
Is there any difference in performance between the operator IS NULL and the function ISNULL()?Looking into the MySQL manual, they seem to be synonyms really. MySQL manual on IS NULL MySQL manual on ISNULL() and even if they aren't, I would tend to tr
I have like 50 txt files each with around 8 columns and 80,000 records. I have written a script in Matlab that reads all the files one by one and then puts it into MySQL using a single INSERT statement for each file. However doing so is taking a huge
Tried my usual references at w3schools and google. No luck I'm trying to produce the following results. QTY is a derived column | Position | QTY -------------------- 1 Clerk 2 2 Mgr 2 Here's what I'm not having luck with: SELECT Position, Count(posit
I really hope someone can help me with this. I'm struggling with it for nearly two days now... I have a DB-table "Device" and a table "Connection". I'm using it to visualize my company's network. To pass the data to the JS-framework I
I have four tables I want to join and get data from. The tables look something like... Employees (EmployeeID, GroupID[fk], EmployeeName, PhoneNum) Positions (PositionID, PositionName) EmployeePositions (EployeePositionID, EmployeeID[fk], PositionID[f
I'm building a PHP calendar app for a photography group. They need to be able to assign multiple dates/times to a single event. As of now, I have an Events table and a Slots table (for time slots). Events only has id, title, and description, while Sl