In my sql table, when I select data by using this query, SELECT * FROM agreement_id, hierarchy_id, customer_no FROM rebate_agreement WHERE Customer_no = 'Kap-ST'; While I use the above query it filters the records as below, agreement_id hierarchy_id customer_no KAPA2 KHIE1 Kap-ST KAPA3 KHIE1 Kap-ST KAPA4 * Kap-ST I want to filter 1st, ...
databaseanswers.net Latest Questions
I got a select that groups the total value of a column, but also I need the percentage referring to each sum referring to the total sum! As an example of today’s return: id|sum 1| 10 2| 50 3| 80 4| 20 ...
For an assignment I have which includes a delete and add friend system (like Facebook), I’ve made a query that works by using two SQL tables, one which includes a friend_id, name and other information, and another which holds two ...
Question Imagine having the following PostgreSQL table: CREATE TABLE setting ( user_id bigint PRIMARY KEY NOT NULL, language lang NOT NULL DEFAULT 'english', foo bool NOT NULL DEFAULT true, bar bool NOT NULL DEFAULT true ); From my ...
I’m trying to get at least two rows from query using max. I have a query for getting all customers cars and need to combine this with last date of service and order number. select b.year, b.class, b.vin, b.plates, a.name, a.street, ... from cars b left join customers ...
I am a newbie in mysql. I have data Table2 with code (scan from barcode) sorted Code: AA0044 AA0045 AA0050 BA0002 BA0003 BB0001 BC0012 BC0013 BC0015 Operator will scan a value, save in Table 1, and then the result must be 3 first row, data start with code that scanned by ...
here is my code: $allocations = QueryBuilder::for(TimeAllocation::class) ->with([ 'cachable' => fn($q) => $q->with(['employee' => fn($q) => $q->with('qb_employee')]), ...
I have a PHP script that create a MySQL table, insert data in it an than use this table in a select query with join. The last query never ends. If i excete two script, the first that create a ...
I need distinct all selected columns, except one, how to do it? I use flamerobin. For example: Select distinct p.one, a.two, v.tree from test a, test1 p, test2 v; For a.two I don’t need distinct. Any suggestions?
I’m currently writing a relatively complex SQL statement which selects data from multiple tables and has quite a few sub-statements and joins. In my "final" data set, I want to return raw data as well as comparisons between the raw ...